Struts 2 tag summary_ Power node Java college sorting

Let's take a look at the classification of struts 2 Tags first. Then classify and summarize.

Because the control label is used more, it is placed in the front. OK, first look at the control label.

1、 We should all have used the control tag of JSTL. In fact, the control tag of struts 2 is very similar to that one. It is mainly used to supplement those that cannot be satisfied by El expressions. Here's a brief look:

1. If... Else if... Else, used to control the label selected for output;

2. Append: used to splice multiple sets into a new set;

3. Generator: a string parser, which is used to parse a string into a collection;

4. Iterator: it is an iterator used to iterate the output of a set. This comparison uses ha. There are all examples in the front, so there is no more example;

5. Merge: it is also used to splice multiple sets into a new set, but it is different from append. Append is to arrange and splice the sets in sequence. Merge is the first of the first set, the first of the second set... The second of the first set, the second of the second set;

6. Sort: this tag is used to sort the collection;

7. Subset: this tag is used to intercept some elements of the set to form a new subset.

2、 Data labels, self perception data labels are not used very much:

The action tag allows you to call the action directly in the JSP page. When calling the action, you can specify the name and namespace of the action to be called If the property value of the executeresult parameter is specified as true, the tag will include the processing result (view resource) of the action in this page The attributes specified with the action tag are:

ID: optional attribute, as the reference ID Name: required attribute of the action, specify the calling action namespace: optional attribute, specify the namespace executeresult: optional attribute of the label calling the action, and specify whether to include the processing result of the action in this page The default value is false, excluding

Bean instantiates a JavaBean. The implementation class VaR of the JavaBean instantiated by passing in the param attribute (get / set) name is optional. If it is specified, the context in which the instance is put into the stack allows VaR to be used directly. Note: the JavaBean instance created in the bean tag is at the top of the stack, and the value stack is removed at the end of the bean. Unless VaR is not specified, it is accessed through the context

Date format the output date. Specify the time difference between the date and the date of the day. Formart specifies the format date. Note: you don't want nice to specify it at the same time. If you specify it at the same time. Whether the formart nice specifies the difference between the date and the current date is ignored. The formatted date value var object is put into the value stack and can be referenced by the value of this attribute at the end of date

< constanname = "sruts. Custom. I18N. Resources" value = "applicationresources" / > < s: datename = "#date" formart = "yyyy MM DD" / >

Debug tag:

Used to assist debugging Generate hyperlinks on the page to view the value stack and a reference ID of all information elements in the stackcontext

Include: a JSP or servlet is included in the JSP or servlet contained in the current page value. You can specify multiple param sub tags to pass parameters

Param tag: for other tags, provide the name (set) of the parameter set by parameter name and the value usage of the parameter set by value

Push: put a value at the top of the value stack. Value required: specify the stack value put into the value stack! However, only in the push tag, once exceeded, the object just put in will be removed immediately

Usage:

Set: used to put a variable into the specified range and define a new variable. Put the existing value into the new variable. And put it into the specified range. Value specifies an expression, and the calculated result is assigned to the variable. If the value attribute is not specified, the stack top object is assigned to the variable by default. Var specifies this attribute, changes the value and puts it into the value stack. Scope specifies the scope to prevent new variables. Optional application, session request page action (default). If it is specified as action, put it into request and put it into the action value stack name variable name

The I18N text tag supports internationalization information. I18N puts the resource package into the value stack name resource attribute name specifies the base name of the resource package. Text obtains the information from the resource package Title obtains the message with the key title. The resource package placed through I18N can only be accessed in the tag body. Text can be used alone. First, find the resource package whose base name is the same as the calling action class name, which means that the resource file with the same name as the action class can be created in the package where the action class is located. Param can be nested to specify the parameters of the message text. The order corresponds to the parameter index order < s: i18nname = "applicationresources" > < s: textname = "title" / > name resource attribute name ID specifies the attribute, The text content will not be output, but is saved in the value stack. After the end of text, you can refer to < / s: I18N > through the value of the attribute

public class TextTagAction extends ActionSupport{} 《topic-21》

The URL tag is used to create the URL address, define the param additional request parameter action value, and specify the action and URL of the generated URL. The previous one will be attached action。 If there are neither, take the current address as the address value. Achor optional. Specify the anchor code of the URL. Encode the specified parameters. Cookie rewriting is not supported. URL supports session escape. Whether to escape & to & var. put the link value into the value stack includecantext. Whether to include the current context in the URL address. Includeparams contains the request parameters. The modified attribute value can only be none, Getall method specifies the method to use the action namespace specifies the namespace to which the action belongs portletmode specifies the portlet mode scheme specifies the protocol to use for the URL

The property tag is used to output the property value value of the object in the value stack. Value specifies whether the object to be output has no property. If the default optional value at the top of the output stack is null, the output value change escape specifically outputs the HTML in the content

3、 The form tag, which is the tag provided by struts 2 under the form, is used for interface display. In fact, it is less used. Generally, we will replace some special interface frameworks such as easy UI and DWZ. In fact, to put it simply, it is like various tags in HTML, which will not be repeated here

4、 Non standard single tag is mainly used to generate some non form visual elements, such as tab page, tree structure of output HTML page, etc. of course, it is also used to display the information encapsulated in action. Briefly introduce:

Simply look at a component tag:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>