JSP Coding Specification

Source: Internet
Author: User

JSP contains files

<% @ include file = "Relativeuri" %>                   //perform loading in the translation phase, for example: Verifying whether the login is passed

The include directive element of the JSP reads the contents of the specified page. and combine the content with the original page. (This process is done during the translation phase: that is, the JSP is transformed into a servlet.)

Translation phase:

JSP pages cannot be passed to the browser intact, and all JSP elements must first be processed by the server. This is done by passing the JSP page into a servlet and then executing the servlet. The server needs a JSP container to process the JSP pages. The JSP container is usually implemented in the context of the servlet, which is configured to handle all requests to the JSP page.

The JSP container attaches importance to translating the JSP page into a servlet (called the JSP page implementation Class-JSP page implementation Class) and compiles the servlet. These two steps make up the translation phase

<pageflush/>   //load is performed during the request processing phase (runtime), For example: it is closely related to the current page data.

Introduces the answer text that is innate by the execution page or servlet.

Request Processing phase:

The JSP container, in addition to the above-mentioned emphasis on translating JSP pages into Servlets , also attaches importance to invoking JSP page implementation classes to process each request and generate an answer . This phase is called the request processing phase . The request processing phase executes only class documents

Carrying parameters:

<jsp:include page= "<%=pageSelectedAtRuntime%>" flush= "true" >

<jsp:param name= "Fitstparamer" value= "Firstvalue" >

<jsp:param name= "Lastparamer" value= "Lastvalue" >

</jsp:include>

-----------------------------------------------------------------------------------------

Jump page:

It is recommended to use Response.sendredirect () instead of the <jsp:forward> command to implement page jumps.

Because when the non-cached output is set, if the JSO file already has data before using <jsp:forward>,

The file execution will go wrong. The specification is response.sendredirect ("****.jsp"), and at the same time, the jump on the page

Or when the link is open, you must not refuel in the parameters of the page, the URL parameter should be in English.

-----------------------------------------------------------------------------------------

Using El expressions, try to avoid <%%> this form of code, JSP only responsible for data presentation, not responsible for business logic.

The file is named lowercase, and the function + object is named in the way. Example: listcustomer.jsp addcustomer.jsp

Page Support minimum 1024x768 screen resolution (actual size is 960*434), that is, the horizontal scroll bar cannot appear

label to have width,height attribute

Page to define the background color, the system default value can be changed by the user arbitrarily.

JSP Coding Specification

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.