Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"jsp:attribute" in "c:if" to add "class" on "li"

843840Jul 8 2008 — edited Jul 8 2008
Hi,

I want to add a "class" attribute to a "li" tag depending on a variable. I have this code :

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
...
<jsp:element name="li">
<c:if test="${param.appli == 'aze'}">
<jsp:attribute name="class">active</jsp:attribute>
</c:if>
<jsp:body>
...
</jsp:body>
</jsp:element>

This is one of my multiples tries.

the problem seems to be when "jsp:attribute" is in "c:if". Without "c:if", "jsp:attribute" work well. Inverse, alone, "c:if" with a test text work well.

Any idea ?

Thanks,

Xavier
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 5 2008
Added on Jul 8 2008
3 comments
3,198 views