JSP summary five: JSP elements

Source: Internet
Author: User

SP Notes
<%--*****--%> is an annotation character.


instruction Element

the
directive element is used to specify information about the Web page itself. For example:


<%@ page contenttype= "text/html"%>

The
instruction element begins with the <%@, ending with%>. Page is the instruction name, contenttype is a property name of the page directive, and "text/html" is the property value. Directive elements are case-sensitive. The settings for this directive specify the page content type. If you do not set the ContentType property, the default value is text/html.

other attributes of the
page directive and Errorpage,iserrorpage,session,pageencoding,buffer,autoflush,


Language,import property.


 


Other instruction elements and
.

<%@ include ...%> introduces a file in the translation phase


<%@ taglib ...%> declares a tag library used by a page that contains custom behavior.


Taglib need to explain the following example:


<%@ taglib prefix= "C" uri= "Http://java.sun.com/jsp/jstl/core" %>

The
URI represents the Jstl library provided by Sun. The value of the prefix represents the library that the URI refers to. Used in the behavior element that follows. For example:


<%@ page contenttype= "text/html"%>


<%@ taglib prefix= "C" uri= " http://java.sun.com/jsp/jstl/core"%>








<title>jsp is easy</title>





<body bgcolor= "White" >


 


are as easy as ...


 


<%--Calculate The sum of 1 + 2 + 3 dynamically--%>


1 + 2 + 3 = <c:out value= "${1 + 2 + 3}"/>


 


</body>




The
<c:out represents an Out object in the Jstl library.


Behavioral Element


An element that performs certain actions when a browser requests a page, called a behavior element. The JSP defines some standard behavior elements, as follows:


<jsp:useBean> make a JavaBeans component available on this page


<jsp:getProperty> obtains a property value from a JavaBeans component and adds it to the answer


<jsp:setProperty> Set JavaBeans property value


<jsp:include> introduces an answer result from a servlet or JSP page in the request processing phase


<jsp:forward> forwards processing of requests to a servlet or JSP page


<jsp:param> Use <jsp:include> or <jsp:forward> to transfer a request to another servlet or JSP page, add a parameter value to the request.

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.