JSTL expressions inside JSF Component

Hello *

I am experiencingc:if tag issues if embedded insideh:panel tags. Nesting a singlec:if tag works fine, but nesting two breaks the app.

Therefore I have to seprate out the JSTL tags into there own h:panel...bit messy.

Anyone else experence similar probs?

All the best.

J

[339 byte] By [jamesclintona] at [2007-11-26 15:09:24]
# 1
Can you provide a reproduceable code snippet?And do you know the rendered attribute of any JSF component? I guess that this is what you have to use instead of the c:if.
BalusCa at 2007-7-8 8:59:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

As requested.

Init locked state is = true.

From memory unlock btn is displayed, but on submit no render difference.

<h:panelGrid >

<c:if test="${locked}">

<h:commandButton type="submit" value="Unlock" action="#{bean.unlock}" immediate="false" />

</c:if>

<c:if test="${not locked}">

<h:commandButton type="submit" value="Save" action="#{bean.save}" immediate="false" />

</c:if>

</h:panelGrid>

CURR_WORKAROUND - has resolved the problem, but not ideal because of additonal panel code which seems pointless

<h:panelGrid >

<c:if test="${locked}">

<h:commandButton type="submit" value="Unlock" action="#{bean.unlock}" immediate="false" />

</c:if>

</h:panelGrid>

<h:panelGrid >

<c:if test="${not locked}">

<h:commandButton type="submit" value="Save" action="#{bean.save}" immediate="false" />

</c:if>

</h:panelGrid>

regards

jamesclintona at 2007-7-8 8:59:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Just replace JSTL by JSF:

<h:commandButton type="submit" value="Unlock" action="#{bean.unlock}" immediate="false" rendered="#{bean.locked}" />

<h:commandButton type="submit" value="Save" action="#{bean.save}" immediate="false" rendered="#{!bean.locked}" />

Where the bean's method isLocked() returns a boolean value representing the locked state.

BalusCa at 2007-7-8 8:59:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
lol (dunno why i didnt think of that!) - that makes much more sense!
jamesclintona at 2007-7-8 8:59:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...