Action commands in JSP include, forward, usebean, getproperty, setproperty, and plugin.
I. include commands
<JSP: Include> the tag indicates a static or dynamic file.
Syntax:
<JSP: Include page = "path" Flush = "true"/>
Or
<JSP: Include page = "path" Flush = "true">
<JSP: Param name = "paramname" value = "paramvalue"/>
</Jsp: Include>
Note:
1. Page = "path" is a relative path or a relative path expression.
2. Flush = "true" must be set to true. The default value is false.
3. The <JSP: param> clause allows you to pass one or more parameters to a dynamic file. You can also use multiple <JSP: param> to pass multiple parameters to a dynamic file.
Ii. Forward Command
<JSP: Forward> the tag indicates redirecting a static html/JSP file or a program segment.
Syntax:
<JSP: Forward page = "path"}/>
Or
<JSP: Forward page = "path"}>
<JSP: Param name = "paramname" value = "paramvalue"/> ......
</Jsp: Forward>
Note:
1. Page = "path" is an expression or a string.
2. <JSP: param> name specifies the parameter name and value specifies the parameter value. The parameter is sent to a dynamic file. The parameter can be one or more values, but the file must be a dynamic file. To pass multiple parameters, you can use multiple <JSP: param> In a JSP file to send multiple parameters to a dynamic file.
Iii. usebean instructions
<JSP: usebean> A tag is used to create a bean instance on the JSP page and specify its name and scope.
Syntax:
<JSP: usebean id = "name" Scope = "Page | request | session | application" typespec/>
Typespec has the following possibilities:
Class = "classname" | class = "classname" type = "typename" | beanname = "beanname" type = "typename" | type = "typename" |
Note:
You must use class or type instead of both Class and beanname. Beanname indicates the bean name in the form of "A. B. C ".
Iv. getproperty command
<JSP: getproperty> the tag is used to obtain the bean property value, convert it into a string, and insert it into the output page.
Syntax:
<JSP: getproperty name = "name" property = "propertyname"/>
Note:
1. Before using <JSP: getproperty>, you must use <JSP: usebean> to create it.
2. You cannot use <JSP: getproperty> to retrieve an indexed property.
3. It can be used with the JavaBeans component <JSP: getproperty>, but cannot be used with Enterprise Java Bean.
5. setproperty command
<JSP: setproperty> tag indicates the attribute value in bean.
Syntax:
<JSP: setproperty name = "beanname" prop_expr/>
Among them, prop_expr has the following possible situations:
Property = "*" | property = "propertyname" | property = "propertyname" Param = "parametername" | property = "propertyname" value = "propertyvalue"
Note:
Use JSP: setproperty to assign values to the attributes of a bean. You can use either of the following methods.
1. Use JSP: setproperty: After JSP: usebean:
<JSP: usebean id = "myuser "... />
...
<JSP: setproperty name = "user" property = "user "... />
In this way, JSP: setproperty will be executed.
2. jsp: setproperty appears in the JSP: usebean Tag:
<JSP: usebean id = "myuser "... >
...
<JSP: setproperty name = "user" property = "user "... />
</Jsp: usebean>
In this way, JSP: setproperty is executed only when a new object is instantiated.
* The name value in <JSP: setproperty> should be the same as the id value in <JSP: usebean>.
Vi. plugin commands
<JSP: plugin> the tag indicates executing an applet or bean. If possible, you need to download a Java Plug-in to execute it.
Syntax:
<JSP: plugin
Type = "bean | applet"
Code = "classfilename"
Codebase = "classfiledirectoryname"
[Name = "instancename"]
[Archive = "uritoarchive,..."]
[Align = "bottom | top | Middle | left | right"]
[Height = "displaypixels"]
[Width = "displaypixels"]
[Hspace = "leftrightpixels"]
[Vspace = "topbottompixels"]
[Jreversion = "Maid number | 1.1"]
[Nspluginurl = "urltoplugin"]
[Iepluginurl = "urltoplugin"]>
[<JSP: Params>
Note:
<JSP: plugin> elements are used to play or display an object (typically an applet and bean) in a browser, and such display needs to be implemented in the browser's Java Plug-in.
When the JSP file is compiled and sent to the browser, the <JSP: plugin> element will be replaced with the <Object> or <embed> element based on the browser version. Note: <Object> is used for HTML 4.0 and <embed> is used for HTML 3.2.
In general, the <JSP: plugin> element specifies whether the object is an applet or bean, the class name, location, and where to download the Java Plug-in.
Copyright statement: This article is excerpted from the Internet and is only for online reference and dissemination. If it is used for other purposes and involves copyright issues, it shall not be liable.