因要用s:if 等标签, 按教材在web.xml中定义了<taglib>以及<taglib-location>等, 配置应该是没问题的, 按教材填写的, 不使用if等标签就没问题, 一旦使用if标签, 就提示javax.servlet.ServletException: org.apache.jasper.JasperException: Unable to read TLD "META-INF/taglib.tld" from JAR file "file:/F:/Tomcat 6.0/webapps/coca/WEB-INF/lib/struts2-core-2.0.11.1.jar": java.lang.NullPointerException. 可是struts2-core-2.0.11.1.jar/META-INF/里面没有taglib.tld啊,只有struts-tags.tld, 应该怎么解决这个配置问题?
<s:set name="age" />
<s:if test="age > 6">
大人
</s:if>
这种标签的时候,就出错了, 提示org.apache.jasper.JasperException: /case.jsp(72,3) According to TLD or attribute directive in tag file, attribute test does not accept any expressions如果在web.inf中配置好taglib的话, 就提示javax.servlet.ServletException: org.apache.jasper.JasperException: Unable to read TLD "META-INF/taglib.tld" from JAR file "file:/F:/Tomcat 6.0/webapps/coca/WEB-INF/lib/struts2-core-2.0.11.1.jar": java.lang.NullPointerException. 我使用的tomcat 6.0.1.4, struts2-core-2.0.11.1
<s:if test="#month>0 && month<=3">
第一季度
</s:if>
<s:else>
输入错误
</s:else>使用OGNL表达式#month, 一切正常, 输出结果为第一季度但改成EL表达式, <s:set name="month" value="1" />
<s:if test="${month>0 && month<=3}">
第一季度
</s:if>
<s:else>
输入错误
</s:else>就马上提示出错org.apache.jasper.JasperException: /case.jsp(72,3) According to TLD or attribute directive in tag file, attribute test does not accept any expressions 怎么解决?
strut2用ognl替代了原来的EL作为默认的页面el引擎, 直接在struts2里使用原el是不行的
如果想使用原EL的话可以通过配置使用,方法网上有