JSTL配置详细解决方法

 

1。将JSTL。JAR和STANDARD。JAR放到WEB下的WEB-INF下新建个LIB文件夹放到其中
2。TLD下的8个TLD文件放进WEB/WEB-INF/下(可以新建个TLDS文件夹)
3。把jakarta-taglibs-standard-1.1/jakarta-taglibs-standard-1.1.2/lib/org文件夹拷贝到 src下放JAVA类包的地方因为标签库描述符是从这里来链接标签处理程序的。
4。在WEB.XML中 添加映射:
一定要把TAGLIB写在JSP-CONFIG标签中否则会报错
<jsp-config>
        < taglib>
        < taglib-uri>http://java.sun.com/jstl/core_rt</taglib-uri>
        < taglib-location>/WEB-INF/c-rt.tld</taglib-location>
        </taglib>
        < taglib>
        < taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
        < taglib-location>/WEB-INF/c.tld</taglib-location>
        </taglib>
        < taglib>
        < taglib-uri>http://java.sun.com/jstl/fmt_rt</taglib-uri>
        < taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
        </taglib>
        < taglib>
        < taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
        < taglib-location>/WEB-INF/fmt.tld</taglib-location>
        </taglib>
        < taglib>
        < taglib-uri>http://java.sun.com/jstl/sql_rt</taglib-uri>
        < taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
        </taglib>
        < taglib>
        < taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
        < taglib-location>/WEB-INF/sql.tld</taglib-location>
        </taglib>
        < taglib>
        < taglib-uri>http://java.sun.com/jstl/x_rt</taglib-uri>
        < taglib-location>/WEB-INF/x-rt.tld</taglib-location>
        </taglib>
        < taglib>
        < taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
        < taglib-location>/WEB-INF/x.tld</taglib-location>
        </taglib>
        </jsp-config>
5。在JSP中导入
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
6。测试
<html>
        < head>
        < meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        < title>JSP Page</title>
        </head>
        < body>
        < h1>JSP Page</h1>
        < br/>
        <c:set var="er" value="${3+1}" scope="session"/>
        <c:out value="${er}"/>
        </body>
</html>

你可能感兴趣的:(JSTL配置详细解决方法)