eclipse中使用jstl

    xiaoxiao2021-03-26  13

    今天学习jsp中涉及到如何使用jstl,因为是用eclipse的开发环境,所以也学会了怎么在eclipse里使用jstl。 现在网上把jstl.jar和standard.jar,地址http://www.apache.org/dist/jakarta/taglibs/standard/binaries/ 在eclipse里新建动态网页项目testJstl,将jstl.jar和standard.jar复制到WEB-INF文件夹下的lib目录里。 然后在web.xml里添加taglib标注 例如: ...... <jsp-config>         <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</taglib-uri>             <taglib-location>/WEB-INF/fmt.tld</taglib-location>         </taglib> ....... </jsp-config> ........ 然后在新建的jsp文件里就可以使用jstl了 例如: <%@ page language="java" contentType="text/html; charset=GB18030"     pageEncoding="GB18030"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title>Insert title here</title> </head> <body> <fmt:requestEncoding value="GB2312" /> Name: ${param.username}</br> Password: ${param.password }</br> Habbits:   ${paramValues.habit[0] } ${paramValues.habit[1] } </body> </html>
    转载请注明原文地址: https://ju.6miu.com/read-450288.html

    最新回复(0)