JSP three major instructions

Source: Internet
Author: User

JSP three major instructions
1.page--> is the most complex, <% @page language = "java" info = "xxx". %>
*pageencoding and ContentType:
>pageencoding: It specifies the encoding of the current JSP page, as long as you do not lie, there will be no garbled
You need to use pageencoding! when the server wants to compile the JSP into. Java
>contenttype: It means adding a response header: content-type! equals Response.setcontenttype ("Text/html;charset = Utf-8");
> If two attributes only provide one, then the other default value is set to that one
> If two properties are not set, the default is ISO
*import: Guide Pack! can appear multiple times
*errorpage and Iserrorpage
>errorpage: If the current page throws an exception, which page to forward to, by ErrorPage to specify
>iserrorpage: It specifies whether the current page is an error-handling page! When this property is true,
This page will set the status code to 500! And this page can use the exception! in 9 large built-in objects
* <error-page>
<error-code>404</error-code>
<location>/error/errorPage.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error/errorPage.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.RuntimeException</exception-type>
<location>/index.jsp</location>
</error-page>
* AutoFlush and buffer
>autoflush: Specifies whether the JSP output buffer is full, automatically refreshed! The default is True,
If False, throws an exception when the buffer is full!
>buffer: Specifies the buffer size, which defaults to 8kb and does not usually need to be modified!
* Iselignored: Whether to ignore the El expression, the default value is False, not ignored, that is, support!
* Basic No
>language: Specifies the language type of the current JSP compilation, the default value is Java
>info: Information
>isthreadsafe: Does the current JSP support concurrent access?
>session: Whether the current page supports session, if False,
Then the current page has no session this built-in object
>extends: Let the JSP-generated servlet inherit the class specified by this property!

2. Include--static inclusions
* Features similar to RequestDispatcher's include () Method!
* <% @include%> It is done in JSP compiled into a Java file! Together, they generate a Java (that is, a servlet file),
And then generate a class!
*requsetdispatcher's include () is a method that contains and is comprised of two servlets,
That is, two. class, which simply merges the contents of the response at runtime!
* Role: To break down the page, using the same way as it is contained, so that a constant part of the page,
is a standalone JSP, and we only need to deal with changing pages!

3.taglib Import Tag Library
* Two properties
>prefix: Specifies the prefix of the tag library in this page! by our own name!
>uri: Specify the location of the tag library!
><% @taglib prefix = "s" uri = "/struts-tags"%> prefix usage <s:text>









JSP three major instructions

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.