JSP learning Summary-JSP page elements

Source: Internet
Author: User
Tags html comment

JSP page elements:

---- Static part ----- HTML static text

---- Command ----------- starts with "<% @" and ends with "%>"

---- Expression -------- <% = Java expression %>

---- Script ----------- <% Java code %>

---- Declare ----------- <%! Function or method %>

---- Action ----------- start with "<JSP: Action name" and end with "<JSP: Action Name>"

---- Comment ----------- <! -- Annotation: the client can see -->, <% -- Annotation, and the client cannot see -- %>

 

 

JSP notes:

<! -- Comment content --> HTML comment

<% // Comment content %> JSP normal comment

<%/* Comment content */%> JSP normal comment

<% -- Comment content -- %> JSP hide comment

 

 

Script element:

<% = (1 + 2) %> JSP expression, which cannot end with a semicolon.

<% Date = new date (); Out. println (date. gethours (); %> JSP script

<%! Int I = 0; void count () {I ++ ;}%> <%! Public class peaple {private string name; Public getname () {return name ;}%> JSP Declaration (variables, methods, classes)

 

 

Command element:

<% @ Page [Language = "Java"] [contenttype = "text/html; charset = ISO-8859-1"] [method = "dopost"] [inport = "Java. io. *, Java. util. hashtable "] [session =" true "] [errorpage =" error. JSP "] [iserrorpage =" true "] [buffer =" 24kb "] %>
Page command

<% @ Includ file = "url" %> include command

 

 

Action element:

<JSP: Include page = "admin/login. jsp"/> contains actions

<JSP: Forward page = "admin/login. jsp"/> Redirection

<JSP: Param mane = "parametername" value = "<% = STR %>"/> Pass Parameter commands

<JSP: plugin type = "bean | applet" code = "classfiledirectoryname" codebase = "classfiledirectoryname"/> execute the applet or bean tag

 

 

 

 

 

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.