This content has been marked as final.
Show 6 replies
-
1. Re: duplicate Id problem
luxspes May 1, 2009 3:20 AM (in response to nitm)Simple: Because you have 2 panel groups and they both have id="userPanel".
-
2. Re: duplicate Id problem
nitm May 1, 2009 9:41 AM (in response to nitm)right, im aware of that..
BUT only one of them should be rendered, since the first one is rendered only if identity.loggedIn while the second if not identity.loggedIn and clearly identity.loggedIn can not be both true and false.
is this the wrong the way to do this? how else am i supposed to create a div which has a different set of elements based on if the user is logged in or not?thanks, nitzan;
-
3. Re: duplicate Id problem
clerum May 1, 2009 4:42 PM (in response to nitm)I'm pretty sure that it has to parse the entire page before deciding if it's rendered or not.
-
-
5. Re: duplicate Id problem
luxspes May 3, 2009 2:41 AM (in response to nitm)
nitzan tomer wrote on May 01, 2009 09:41:
right, im aware of that..
BUT only one of them should be rendered, since the first one is rendered only if identity.loggedIn while the second if not identity.loggedIn and clearly identity.loggedIn can not be both true and false.
is this the wrong the way to do this? how else am i supposed to create a div which has a different set of elements based on if the user is logged in or not?
You mean like this?:<h:panelGroup layout="block" id="userPanel" > <ui:fragment rendered="#{identity.loggedIn}"> #{identity.username} [<a href="#" onclick="return false;">Log Out</a>|<a href="#" onclick="return false;">Profile</a><a href="#">Settings</a>] </h:panelGroup> </ui:fragment> <ui:fragment rendered="#{not identity.loggedIn}"> Guest [<a href="#" onclick="page.showAuthenticationForms(); return false;">Log In / Register</a>] </ui:fragment> </h:panelGroup>
or like this?:<h:panelGroup layout="block" id="userPanel" > <c:if test="#{identity.loggedIn}"> #{identity.username} [<a href="#" onclick="return false;">Log Out</a>|<a href="#" onclick="return false;">Profile</a><a href="#">Settings</a>] </c:if> </ui:fragment> <c:if test="#{not identity.loggedIn}"> Guest [<a href="#" onclick="page.showAuthenticationForms(); return false;">Log In / Register</a>] </c:if> </h:panelGroup>
The difference between c:if and ui:fragment is like the difference between c:forEach and ui:repeat.
thanks, nitzan;Click HELP for text formatting instructions. Then edit this text and check the preview.
-
6. Re: duplicate Id problem
nitm May 3, 2009 10:05 PM (in response to nitm)excellent!
thanks a lot for your helpnitzan;