JSP syntax Overview

Source: Internet
Author: User

1,JSPExpression:<% = Expression %>Calculates the expression and outputs the result. EquivalentXMLExpression:

<JSP: expression>

Expression

</Jsp: expression>

The following predefined variables are available:Request, Response, Out, Session, Application, Config, Pagecontext. You can alsoJSP Scriptlet.

JSP Scriptlet<% Code %> code inserted to the service method. EquivalentXMLExpression:

<JSP: scriptlet>

Code

</Jsp: scriptlet>

2,JSPDeclaration: <%! Code %> the code is insertedServletClass (outside the service method ). EquivalentXMLExpression:

<JSP: Declaration>

Code

</Jsp: Declaration>

 

3. The page command <% @ pageatt = "Val" %> acts onServletGlobal commands of the engine. EquivalentXMLExpression is

<JSP:Directive. Page ATT = "Val" \>.

The valid attributes are as follows:

Import = "package. Class"

Contenttype = "mime-type"

Isthreadsafe = "True | false"

Session = "True | false"

Buffer = "size kb | none"

Autoflush = "True | false"

Extends = "package. Class"

Info = "message"

Errorpage ="URL"

Iserrorpage = "True | false"

Language = "Java"

4. include command <% @ include file ="URL"%> WhenJSPConvertServletMust contain the specified files on the local system. EquivalentXMLExpression:

<JSP:Directive. Include File ="URL"\>. WhereURLMust be relativeURL.

The JSP: include action can be used in the request (insteadJSPConvertServlet.

5,JSPAnnotation <% -- Comment -- %> annotation;JSPConvertServletIs ignored. If you want to embed comments into the resultsHtmlDocument, using commonHtmlAnnotation mark <-- Comment -->.

6. jsp: include action <JSP: Include page = "relativeURL"Flush =" true "/> whenServletWhen a request is sent, the specified file is introduced. If you want to include a file during page conversion, useJSPInclude command.

Note: On Some servers, the contained files must beHtmlFile orJSPFile, which is determined by the server (usually determined based on the file extension ).

7. jsp: usebean action <JSP: usebean ATT = Val */> or

<JSP: usebean ATT = Val *>... </jsp: usebean>

Find or instantiateJavaBean. Possible attributes include:

Id = "name"

Scope = "Page | request

| Session | application"

Class = "package. Class"

Type = "package. Class"

Beanname = "package. Class"

 

8. jsp: setproperty action <JSP: setproperty ATT = Val */> set bean attributes

Valid attributes include:

Name = "beanname"

Property = "propertyname | *"

Param = "parametername"

Value = "Val"

9. jsp: getproperty action <JSP: getproperty name = "propertyname" value = "Val"/> extracts and outputs bean attributes.

JSP: forward action <JSP: Forward page = "relativeURL"/> Transfer the request to another page.

JSP: plugin action <JSP: plugin attribute = "value" *>

10. </jsp: plugin> Generate the object or embed tag Based on the browser typeJavaPlugin runningJavaApplet.

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.