Struts2 struts labels
1. index. jsp
Access attribute tags
2. struts. xml
/tags.jsp
3. tags. jsp
- Property:
- The property value is a string:
- Property default value:
- Property is set to HTML:
- Set sets the adminName value (the default value is request and ActionContext ):
- Set Value From request:
- Set Value From ActionContext:
- Set setting range:
- Value Range: <% = pagecontext. getattribute ("adminpassword") %>
- Set var, range: ActionContext:
- Use # values:
- Bean defines bean and uses param to set new property values;
- Bean:
- Include into de1.html include static English files
- Include include2.html include static Chinese files
- Include into de1.html contains static English files, meaning % usage
-
- If elseif else: age =
Wrong age! Too young! Yeah!
Null
- Traversal set:
- Custom variables:
- Use status:
| Total number of elements that have been traversed: | Element indexes that have been traversed: | The current value is an even number? : | Is the current number odd? : | Is it the first element? : | Is it the last element? :
- |
- |
<% = Pagecontext. getattribute ("adminpassword") %> 4. TagsAction. java
package com.wxh.action;import com.opensymphony.xwork2.ActionSupport;public class TagsAction extends ActionSupport{private String password;private String username;public TagsAction(){}public String execute(){this.addFieldError("fielderror.test","wrong!");return SUCCESS;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}public String getUsername() {return username;}public void setUsername(String username) {this.username = username;}}
5. Dog. java
package com.wxh.action;public class Dog {public Dog(){}public Dog(String anme){super();this.name=name;}private String name;public String getName() {return name;}public void setName(String name) {this.name = name;}public String toString(){return "dog:"+name;}}
6. S. java
package com.wxh.action;public class S {public static String STR="STATIC STRING";public static String s(){return "static method";}}
7. User. java
package com.wxh.action;public class User {private int age;public User(){System.out.println("user.constructor!");}public User(int age){super();this.age=age;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public String toString(){return "user"+age;}}
8.include1.html
Include1.html
9.20.de2.html
Chinese