solutions for El Expressions in JSP pages that do not work
2009-09-21 09:30:32| Category: Programming | font size Subscriptions
I use myeclipse6.5 tomcat5.5, as if tomcat5.0 above all support Jstl.
I also find a lot of information, tried a lot of methods, including the revision of JSP version, download package, modify Web.xml, etc., later can, but changed a lot of places, and then try to restore some of the changes back, but also can, and finally just press the first method on it.
Law I:
jsp2.5
<?xml version= "1.0" encoding= "UTF-8"?>
<web-app xmlns= "Http://java.sun.com/xml/ns/javaee" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" version= "2.5" xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_ 5.xsd ">
jsp2.4
<?xml version= "1.0" encoding= "Iso-8859-1"?>
<web-app xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "Http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version= "2.4" >
The jsp2.4 version supports El expressions by default, but 2,5 the default shutdown
If the expression doesn't work, you can look at the JSP version. If it is 2.5, you can replace it with 2.4 to try.
Add in JSP page
<%@ taglib uri= "Http://java.sun.com/jsp/jstl/core" prefix= "C"%> such a remark
That's it (I changed it)
Law II:
If you don't, you can try downloading the JSTL package
Download in http://jakarta.apache.org/taglibs/index.html
Jakarta-taglibs-standard-current.zip, after decompression, the TLD folder of the. TLD Copy to the Web_inf, the Lib Jtsl.jar and Standard.jar to the project's Lib folder.
And then in the JSP
<%@ taglib prefix= "C" uri= "/web-inf/c.tld"%>
Law III:
Modify the Web.xml, plus the following statement:
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/xml</taglib-uri>
<taglib-location>/WEB-INF/x.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/sql</taglib-uri>
<taglib-location>/WEB-INF/sql.tld</taglib-location>
</taglib>
</jsp-config>
Import <%@ taglib prefix= "C" uri= "Http://java.sun.com/jsp/jstl/core"%> in the JSP.
A lot of resources, some did not write down: If not resolved, you can look at these 2 pages http://hi.baidu.com/yych13/blog/item/be00ea0985f05ec93ac76376.html
http://www.programfan.com/club/showtxt.asp?id=274120