标签:color ext cti code struts get port ret div
三种方式的简单说明
1 public class LoginAction extends ActionSupport 2 { 3 private String username; 4 private String password; 5 6 public String getUsername() 7 { 8 return username; 9 } 10 11 public String getPassword() 12 { 13 return password; 14 } 15 16 public void setUsername(String username) 17 { 18 this.username=username; 19 } 20 21 22 public void setPassword(String password) 23 { 24 this.password=password; 25 } 26 27 }
1 <a href=‘login?username=??&password=??‘>
域模型传递 声明成员对象 提供get/set方法
1 public class LoginAction extends ActionSupport 2 { 3 private User user; 4 5 public String getUser() 6 { 7 return password; 8 } 9 10 public void setUser(User user) 11 { 12 this.user=user; 13 } 14 15 }
1 public class User 2 { 3 private String username; 4 private String password; 5 6 public String getUsername() 7 { 8 return username; 9 } 10 11 public String getPassword() 12 { 13 return password; 14 } 15 16 public void setUsername(String username) 17 { 18 this.username=username; 19 } 20 21 public void setPassword(String password) 22 { 23 this.password=password; 24 } 25 26 }
1 <a href=‘login?user.username=??&user.password=??‘>
1 public class LoginAction extends ActionSupport implements ModelDriven<User> 2 { 3 private User user=new User(); 4 5 @Override 6 public User getModel() 7 { 8 return user; 9 } 10 }
1 <a href=‘login?user.username=??&user.password=??‘>
标签:color ext cti code struts get port ret div
原文地址:http://www.cnblogs.com/laxilo/p/7222501.html