0

I'm trying to implement a composite that has a few buttons in it.

This component is aimed to be used in several contexts, so the navigation cases may be passed as parameters to the component but in some cases I would like to just refresh the view (by returning null or using a void method, as mentioned in this answer) - when I use this, the view is refreshed but the component stays open (it should close on action completion) - if a navigation case is used, the page reloads (the component is effectively closed) but all selection states are lost.

Is there any way to navigate to current page without loosing state, or even just hide the composite after the actions are run?

Note: view-scope.

Community
  • 1
  • 1
nuno
  • 1,771
  • 1
  • 19
  • 48
  • You mean to say, even when you return `null` or `void`, all `@ViewScoped` beans are recreated? – BalusC Sep 15 '14 at 15:05
  • I realized the question wasn't clear, I edited the question for better comprehension - thank you for pointing that out. – nuno Sep 15 '14 at 15:08
  • The phrase *"the component stays open"* is too vague and ambiguous. JSF components doesn't have anything like "open" and "closed". Don't you mean "rendered"? – BalusC Sep 15 '14 at 15:17
  • Yes, I mean "rendered". Are suggesting some sort of `rendered` control of the whole component? – nuno Sep 15 '14 at 15:25
  • Why don't you just change the `rendered` condition responsible for showing the part back to `false` and include it in ajax update? – BalusC Sep 15 '14 at 15:29
  • That would mean an explicit call to the `rendered` attribute (like ``) every time I would like to call `mycomp`. Plus, that makes me control the rendering using a `boolean` property in the bean. If I have no other choice I'll do this but I was checking if there was another approach to this. – nuno Sep 15 '14 at 15:39
  • You mean you didn't already have one? How exactly are you "opening" it then? Just do the reverse way of that. – BalusC Sep 15 '14 at 16:20

0 Answers0