Functions of JSP actions
JSP actions use tags in XML syntax to control the behavior of the Servlet engine. JSP actions can be used to dynamically insert files, reuse the JavaBean component, redirect users to another page, generate HTML code for the Java plug-in, and define custom tags through the tag library
----- Start mark
----- End mark
------- Empty tag
Including:
<Jsp: include>
<Jsp: param>
<Jsp: forward>
<Jsp: plugin>
<Jsp: useBean>
<Jsp: setProperty>
<Jsp: getProperty>
<Jsp: useBean> tag
Create a Bean or obtain an existing Bean from the server
Syntax:
<Jsp: useBean name "name"/>
Or
<Jsp: useBean name "name">
Initialization code
</Jsp: useBean>
Jsp: useBean action is used to load a JavaBean that will be used on the JSP page. This function is very useful, because it allows us to take advantage of Java component reuse and avoid the convenience of JSP being different from Servlet!
After obtaining the Bean instance, you can modify the Bean attributes either through the jsp: setProperty action or by using the object variable named by the id attribute in the Scriptlet, you can call this object to explicitly modify its attributes.
Id attribute-unique Bean value referenced throughout the page
Bean name rules:
Unique
Case Sensitive
The first character must be a letter.
Spaces are not allowed.
You can specify different id values for the same Bean class.
Class attribute-name of the JavaBean class
--- Count Bean does not belong to the package
<Jsp: useBean/>
----- Count Bean belongs to the test package
<Jsp: useBean/>
Type attribute --------- type of the variable that will reference this object
BeanName attribute-specify the name of the serialized Bean
Scope attribute-indicates the Bean environment that should be available
---- Page
---- Session
---- Request
----- Application
Page scope
Store the JavaBean object in the javax. servlet. jsp. PageContext of the current page.
The JavaBean object can only be used on the current page.
Session scope
Store the JavaBean object in an HTTP session
The JavaBean object can be used for all pages within the lifecycle of the current HttpSession.
Request scope
Add JavaBean</