JSP action instruction

zhaozj2021-02-16  114

Today, I have a rest at home, and I will continue to learn in the evening, and the focus is the JSP action instruction.

The action instructions in JSP include: include, Forward, UseBean, GetProperty, SetProperty, Plugin.

First, include instruction

The tag represents a static or dynamic file.

Syntax: or

Note: 1. Page = "path" is a relative path, or represents the expression of the relative path. 2, flush = "true" must use flush to true, it defaults to false. 3, clause allows you to pass one or more parameters to dynamic files, or multiple can be used in a page to deliver multiple parameters to dynamic files.

Second, the Forward instruction tag indicates a file that redirects a static HTML / JSP, or a block. Syntax: or ... Note: 1. Page = "Path" is an expression, or a string. 2, name Specify the parameter name, Value Specifies the parameter value. The parameters are sent to a dynamic file, and the parameters can be one or more values, but this file must be a dynamic file. To deliver multiple parameters, you can use multiple parameters to send multiple parameters to a dynamic file in a JSP file. Third, the USEBean directive tag represents to create a bean instance in the JSP page and specify its name and scope. Syntax: where TypeSpec has the following possible situation: class = "classname" | class = "classname" type = "typeename "| beanname =" beanname "type =" typeename "| type =" typeename "| Note: You must use Class or Type without using Class and BeanName at the same time. Beanname represents the name of the bean, its form is "a.b.c". Fourth, getProperty instructions tag represents the value of the property of the BEAN and convert it into a string, then insert it into the output page. Syntax: Note: 1. Before using , you must create it with . 2. You cannot use to retrieve an attribute that has been indexed. 3, you can use with the JavaBeans component, but cannot be used with Enterprise Java Bean. 5. SetProperty instructions Tag represents the attribute value in the bean.

Syntax: which prop_expr There are several possible scenarios: property = "*" | property = "propertyName" | property = "propertyName" param = "parameterName" | property = " PropertyName "Value =" PropertyValue "Note: Use JSP: setProperty to assign a value for a bean attribute; you can use two ways. 1. Use jsp: setProperty: ... /> in this manner, JSP: SetProperty will be executed. 2, JSP: setProperty appears in the JSP: Usebean tag: ... in this In the way, JSP: setProperty will only be executed when new objects are instantiated. * The Name value in should be the same as the ID value in . 6. PLUGIN instructions Tag indicates an applet or bean, there is a possibility to download a Java plugin for execution it.

转载请注明原文地址:https://www.9cbs.com/read-13348.html

New Post(0)