For the MVC design pattern, we have always emphasized that the fewer Scriptlet code in a JSP clock, the better, but only by the previous concept is difficult to achieve, because the development of the label is particularly troublesome, so in order to simplify the label, but also to make the label more common, so generally in the development (without the use of framework) , you can use the Jstl component to complete the development task.
JSTL:JSP standard tag library,jsp tag library.
Development environment: JDK1.6, Tomcat6.0, Jstl stable version is 1.2
Download down Jstl-1.2.jar, which mainly has the following tag library categories:
1. C.tld: Core Tag library, defines attribute management, iteration, judgment, output
2. Sql.tld:sql Tag Library, defines the query database operation
3. X.tld:xml Tag library for manipulating XML data
4. FN.TLD: Function Tag Library, provides some common operation functions, for example: string function
5. Fmt.tld:I18N format Tag library, format data
can be removed directly from the jar package and placed in the working directory D:\Workspace\WEB-INF
Then put the jar bag into the D:\apache-tomcat-7.0.57\lib.
To verify the JSP:
<%@ page contenttype= "text/html" pageencoding= "GBK"%><%[email protected] taglib prefix= "C" uri= "/web-inf/ C.tld "--%><%@ taglib prefix=" C "uri=" Http://www.mldn.cn/jst/core "%>
This label is equivalent to completing an attribute =out.println ().
Web. XML setting, you can replace the second line with the third row
<jsp-config> <taglib> <taglib-uri>http://www.mldn.cn/jst/core</taglib-uri><taglib-location>/WEB-INF/c.tld</taglib-location> </taglib> <taglib> < Taglib-uri>http://www.mldn.cn/jst/fmt</taglib-uri><taglib-location>/WEB-INF/fmt.tld</taglib-location> </taglib> <taglib> &L T;taglib-uri>http://www.mldn.cn/jst/fn</taglib-uri><taglib-location>/WEB-INF/fn.tld</taglib-location> </taglib> <taglib> < ; Taglib-uri>http://www.mldn.cn/jst/sql</taglib-uri><taglib-location>/WEB-INF/sql.tld</taglib-location> </taglib> <taglib> &L T;taglib-uri>http://www.mldn.cn/jst/x</taglib-uri><taglib-location>/WEB-INF/x.tld</taglib-location> </taglib> </jsp-config>
JSP standard Tag Library (JSTL)--jstl Introduction and Installation