JSP common tags in the Java web

Source: Internet
Author: User
Tags i18n tagname

In the JSP page development process, often need to use the Jstl (Java Server Pages standard tag Library) tab Open Development page, it seems more regular and comfortable. JSTL provides 5 major categories of tag libraries:1. Core Tag Library: provides common support for everyday tasks, such as displaying and setting variables, reusing a set of items, testing conditions, and other actions such as importing and redirecting Web pages.2. Internationalization (i18n) Tag Library: a reference program that supports multiple languages.3. SQL Tag Library: provides standardized support for accessing and modifying databases.4. XML Tag library: Provides support for XML file processing and manipulation, including parsing of XML nodes, iterative, conditional evaluation based on XML data, and execution of Extensible Style language Transformations (extensible Style Language transformations, XSLT).5. Function Tag Library: Implements a specific operation by invoking a function in the function tag library in an El expression, for example: ${fn:contains (sring,substring)}, whose function is to determine whether the string string contains substring strings. Jstl Tag Library use method: Tag library URI prefix using pattern Core Tag library http://java.sun.com/jstl/core C <c:tagname...>internationalization label (i18n) http://java.sun.com/jstl/fmt FMT <fmt:tagname...>SQL Tag Library http://Java.sun.com/jstl/sql SQL <sql:tagname...>XML Tag Library http://java.sun.com/jstl/xml x <x:tagname...>Function Tag Library http://java.sun.com/jstl/functions fn <fn:tagname...>A common use of the core tag library is syntax:<% @taglib prefix="C"Uri="Http://java.sun.com/jsp/jstl/core"%>the commonly used labels are<c:Set var="name"Value="Eric"Scope="Request"&GT;&LT;/C:Set><c: outValue="${pagescope.name}" default="<p> China </p>"Escapexml="false"&GT;&LT;/C: out>"0"End="2"items="${requestscope.contacts}"step="1" var="Stu"varstatus="Varstu">sequence number: ${varstu.count} name: ${stu.name} Gender: ${stu.gender} Age: ${stu.age}<br></c:foreach><c:Set var="language"Value="-php-java-python-js-"Scope="Session"&GT;&LT;/C:Set><c:fortokens items="${sessionscope.language}"delims="-" var="LAN">${lan}<br/></c:fortokens><c:removevar=""/><c:Set var="score"Value=" -"Scope="Session"&GT;&LT;/C:Set> <c:choose> <c:when test="${score>=90}">Excellent results</c:when> <c:when test="${score<90 && score>=80}">Good grades</c:when> <c:when test="${score>=60 && score<80}">Pass the Grade</c:when> <c:otherwise>Fail to pass the grade</c:otherwise> </c:choose>


REDIRECT Label

<c:redirect url= "www.baidu.com" >
<c:param name= "" Value= "" ></c:param>
</c:redirect>

If you use an instance tag in a JSP page, the class you need to use conforms to the JavaBean specification

1) with or without a parametric constructor

2) properties are private

3) All properties are Getter/setter

3 commonly used methods in JSP pages

 <jsp:usebean id= " stu   " class  ="  pkg2. Student   " ></jsp:useBean> <jsp:setproperty Property= " name  "  Name= " stu   " value="  alex   "/> <jsp:getproperty property="  Span style= "COLOR: #800000" >name   " name="  stu   "/> 

JSP common tags in the Java web

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.