Basic Syntax of JSP development technology Reading Notes

Source: Internet
Author: User

JSP files are composed of two types: JSP elements and HTML templates.

HTML templates are mainly used for static Web page display. Based on HTML templates, JSP elements related to dynamic web pages are added to achieve dynamic web page interaction.

Simply put, JSP files are HTML files embedded in Java code.

JSP elements include the following four types:

Command element: used to provide information about the entire JSP page, such as the character set used by the page and the language used by the script; script element: embedded Java code, used to achieve dynamic interaction of the page; Action element: it mainly refers to some action tags used to complete some actions, such as page forwarding and parameter transmission. annotation elements: Used to comment some content in JSP pages.

Page command

<% @ page     language = "scriptingLanguage"     extends = "className"     import = "importList"     session = "ture|false"     buffer = "none|sizekb"     autoFlush = "true|false"     isThreadSafe = "true|false"     info = "info_text"     errorPage = "error_url"     isErrorPage = "true|false"     contentType = "ctinfo"     pageEncoding = "peinfo"     isELIgnored = "true|false"%>

Include command

<% @ include     file = "relativeURLspec"%>

Taglib command

<% @ taglib     uri = "uriValue"     prefix = "prefix"%>

Script element:

Declaration: variables, methods, and classes can be defined. It can be understood as a global variable. <%! Declaration %> JSP expression: After the expression is executed, the result is returned to the client. <% = Expression %> script code: the Java code to be executed during client request processing. <% Scriptlet %>

Action element:

<JSP: Include>: Used to dynamically add resource files to the current page. <JSP: Forward>: used to control page forwarding. <JSP: param>: used to pass parameters, embedded in <JSP: Include>, <JSP: Forward>, and <JSP: Params>. <JSP: plugin>: it is used to load and run a Java program (applet or JavaBean) in a browser; <JSP: Params>: used to pass parameters, which can only be used in <JSP: plugin>; <JSP: fallback>: used to specify the prompt information displayed when the Java Plug-In fails to run normally. It can only be used in <JSP: plugin>. <JSP: usebean>: used to obtain the JavaBean object; <JSP: setproperty>: Used to set attribute values for the JavaBean object; <JSP: getproperty>: used to read the attribute values of the JavaBean object.

 

 

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.