Get user object attributes
If the user has the username and password fields
Get the username attribute <s: property value = "user. username"/>
Obtain the Password attribute <s: property value = "user. Password"/>
If the user contains the address object, and the address object contains the ADDR attribute, you can access
Obtain ADDR attributes <s: property value = "user. Address. ADDR"/>
If the user also contains a common get () method, you can call
<S: property value = "user. Get ()"/>
The preceding is a common method for calling objects in the value stack. the user is the object in the value stack.
Call the static method get () in action. Normal methods cannot be called directly.
<S: property value = "@ com. netshuai. Action. manageraction @ get ()"/>
The above is a call to the static method in the non-value stack.
Call the static method of the JDK class <s: property value = "@ java. Lang. Math @ floor (32.56)"/>
The preceding example can also be written as <s: property value = "@ floor (32.56)"/>. If the preceding class is omitted, the Java. Lang. Math class is used by default. Other classes cannot be omitted.
Call static properties in a common class <s: property value = "@ com. netshuai. model. Address @ City"/>
The city static attribute in address must be declared as public.
Call the constructor of a common class. For example, if the constructor is
Public user (string username)
{
This. Username = username;
}
If the call method is <s: property value = "new COM. netshuai. model. User ('hello'). username"/>, the returned username value is hello.
Obtain list <s: property value = "list"/>
Obtain an element in the list <s: property value = "list [0]"/>
Obtain the list size <s: property value = "list. Size"/>
Get set <s: property value = "set"/>
An element in the set cannot be obtained because the set has no order.
Obtain Map <s: property value = "map"/>
Obtain the values of all keys in the Map <s: property value = "map. Keys"/>
Obtain the values of all values in Map <s: property value = "map. Values"/>
Obtain an element in Map <s: property value = "map ['k1']"/>
obtain all objects in the list . You must override tostring () method to display the object value
Use projection to obtain the username attribute of all objects in the list
Use projection to obtain the username attribute of the first object in the list
obtain objects older than 30 in the list by selecting
obtain the username of the object older than 30 in the list by selecting
obtain the username of the first object older than 30 in the list by selecting or
obtain the username of the last object older than 30 in the list by selecting
Obtain the property <s: property value = "# parameters. Name"/> in parameters.
Obtain the property <s: property value = "# request. Name"/> in the request.
Obtain the attribute <s: property value = "# session. Name"/> in the session.
Obtain the property <s: property value = "# application. Name"/> in the application.
<S: property value = "# ATTR. Name"/> traverse the above four objects in order, and then return the value first found.
% {} Can retrieve the action object in the value stack and call its method directly. For example, % {gettext ('key')} can retrieve international information.
$ {} Can be used in international resource files and struts2 configuration files
Use top to obtain the second object in the value stack <s: property value = "[1]. Top. User"/>
Use top to obtain the attributes of the second object in the value stack <s: property value = "[1]. User"/>
Call the static get () <s: property value = "@ vs @ get ()"/> method of action in the value stack. VS can also be written as VS1.
Call the static method get () of the second action in the value stack <s: property value = "@ vs2 @ get ()"/>
Put an object into the value Stack
Actioncontext. getcontext (). getvaluestack (). Push (User );