Help about JSTL: I can't use <c:if .. > in <option..> !
843838Nov 11 2006 — edited Nov 14 2006Hi, all
I build my project on STRUTS before, and using the tableligs of struts,But now ,I find it is a good choice using JSTL.However ,problems accurred as follows:
(my project is on Eclipse and Tomcat)
In the page , I have already include that:
<%@ taglib uri="/jstl/core" prefix="c" %>
<%@ taglib uri="/jstl/fn" prefix="fn" %>
<%@ page isELIgnored="false"%>
In web.xml, I added that :
<taglib>
<taglib-uri>/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/jstl/fn</taglib-uri>
<taglib-location>/WEB-INF/fn.tld</taglib-location>
</taglib>
Problem occur here:
<select name="category">
<option value="IM1" <c:if test="${CCOption == 0}"> selected</c:if> ><bean:message key="IM1"/></option>
but the system told that " undefined attribute name <c:if .... " that is to say, they cannot find the tag in this page,but I have try to put the <c:if to ..>out , not in the <option...> ,then that is OK.
But in fact ,we can use the tag <c:if....> in such as <option...> and so on . I don't know why I can't.
By the way, in jslt 1.1, JSTl.jar/standard.jar have 15 .tld files , I don't
know what are the differences among the file c-1_0-rt.tld, c-1_0.tld and c.tld(which are inclued in the 15 tld files)?How can I set up JSTL in my Tomcat?
Look forward for your help!
Many thanks in advance!