stuts2的赋值问题 1

1.POJO

 

 

public class UserBean {

	private String username;
	private String password;
              set/getUsername;
              set/getPassword;
}

 2. struts2 Action

 

public class UserInfor extends ActionSupport {

	private UserBean userBean = new UserBean();
                set/getUserBean;

}

 3.页面 :

  

ognl 表达式取值 : ${userBean.username}   

name="userBean.username" 为了与后台action中的userBean的username属性进行绑定

 

UserName:<input type="text" value="${userBean.username}" name="userBean.username"  /><br>
      Password: <input type="text" value="${userBean.password}" name="userBean.password" /><br>

 

 

 

你可能感兴趣的:(问题)