1.list类型封装
2.map类型封装
3.封装单个String,Object,List<String>,List<Object>
页面:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>Insert title here
Test.Action:
import java.util.List;import com.opensymphony.xwork2.ActionSupport;public class TestAction extends ActionSupport { private Liststrs; private List strs1; private List users; private String str1; private User user; @Override public String execute() throws Exception { return super.execute(); } public List getStrs() { return strs; } public void setStrs(List strs) { this.strs = strs; } public List getUsers() { return users; } public void setUsers(List users) { this.users = users; } public String getStr1() { return str1; } public void setStr1(String str1) { this.str1 = str1; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public List getStrs1() { return strs1; } public void setStrs1(List strs1) { this.strs1 = strs1; }}
User.java
public class User { private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Override public String toString() { return "User [username=" + username + ", password=" + password + "]"; }}
strs:
strs1
users
str1: