-
2. Re: h:commandLink not working inside s:fragment
twhitehead.twhiteheadjm.hotmail.com Mar 18, 2008 1:10 PM (in response to msznapka.martin.sznapka.gmail.com)Change getRenderLink to
public boolean getRenderLink() { System.out.println("renderLink called, value was:" + renderLink); return renderLink; }
and it might give us more information about whether your theory is correct.
Your theory doesn't make sense though as the framework should not disable it, it should simply not render it. You are saying it gets rendered but doesn't work.
Try looking at what actually gets rendered in the browser. -
3. Re: h:commandLink not working inside s:fragment
msznapka.martin.sznapka.gmail.com Mar 18, 2008 1:58 PM (in response to msznapka.martin.sznapka.gmail.com)You said:
You must be sure that {contentAround.random} evaluates to true. If contentAround is not in page or session scope, random property will be always false, since on restore view phase contentAround is reinitialized. Rerender attribute is the most painful attribute in JSF world because we expect that jsf will 'remember' the value assigned on render view phase..so it means that I should always initialize booleans to true and than in some method loadPageData() set them correctly?
-
4. Re: h:commandLink not working inside s:fragment
msznapka.martin.sznapka.gmail.com Mar 18, 2008 2:10 PM (in response to msznapka.martin.sznapka.gmail.com)Results (private boolean renderLink = false):
Component creating getRenderLink() getRenderLink() getRenderLink() loadPageData() getRenderLink() getRenderLink() getRenderLink() getRenderLink() getRenderLink() getRenderLink() getRenderLink() Component destroying
Results (private boolean renderLink = true):
Component creating getRenderLink() getRenderLink() getRenderLink() getRenderLink() Link action loadPageData() getRenderLink() getRenderLink() getRenderLink() getRenderLink() getRenderLink() getRenderLink() getRenderLink() Component destroying
In both cases the link IS rendered, both HTMLs are same and both cases behaves differently.
Try looking at what actually gets rendered in the browser.you should :)
-
5. Re: h:commandLink not working inside s:fragment
baspet Mar 18, 2008 5:03 PM (in response to msznapka.martin.sznapka.gmail.com)From your code, renderLink is set to true when calling loadPageData and commandLink is rendered successfully. But, when you click on it, the whole view tries to restore itself. This mean that evaluates again the s:fragment, but getRenderLink() returns false since hello bean is been reconstructed. s:fragment is told to not render so commandLink never calls linkAction. I solve this kind of problems using page scope variables. Your code should work if remove setter - getter of renderLink and use:
@In(required = false, create = true) @Out(required = false, scope = ScopeType.PAGE) private Boolean renderLink;
V.
-
6. Re: h:commandLink not working inside s:fragment
msznapka.martin.sznapka.gmail.com Mar 18, 2008 5:26 PM (in response to msznapka.martin.sznapka.gmail.com)Yeah finally good answer! Thx!
So the good practise for event scoped components is to defaultly set all render booleans to true or to outject render booleans to PAGE scope.
Fine, clear, thx!
Still I think that the framework should be smart in such case and during restore phase does NOT look if the commandLink will be rendered or not, it should just call the action, that is all.
Do you know which framework is responsible for this? JSF? Facelets? Seam? Maybe we can report it to some other forum.
-
7. Re: h:commandLink not working inside s:fragment
baspet Mar 18, 2008 5:44 PM (in response to msznapka.martin.sznapka.gmail.com)
Maybe we can report it to some other forum
It will help many people from suicide!!
-
8. Re: h:commandLink not working inside s:fragment
msznapka.martin.sznapka.gmail.com Mar 18, 2008 6:42 PM (in response to msznapka.martin.sznapka.gmail.com)grrr ;)
-
9. Re: h:commandLink not working inside s:fragment
pmuir Mar 19, 2008 12:26 PM (in response to msznapka.martin.sznapka.gmail.com)
Martin Sznapka wrote on Mar 18, 2008 05:26 PM:
Still I think that the framework should be smart in such case and during restore phase does NOT look if the commandLink will be rendered or not, it should just call the action, that is all.No, this behaviour is correct, if slightly confusing for beginners. The other way around might be less confusing but could easily result in users calling actions they hadn't actually had displayed to them.
Do you know which framework is responsible for this? JSF? Facelets? Seam? Maybe we can report it to some other forum.
JSF spec.
Create an FAQ on this site.