Dear all,
im new to
struts 2 and it is so nice but there is a problem i still didnt found to it a solution.
the problem is:that i make useBean and UserAction(that will be the controller)So i need to pass parameters from the
jsp using the struts2 form to the StrutsAction .If i put the properties inside the Action with their setters and gerters it works.but it doesnt good design.So i separate the properties into Bean .then the controller UserAction recievies null parameters.
Here the code in UserAction that doesnt work:
public
String goToWelcome() throws Exception {
System.out.println("Second Success Action");
UserBean userBean=new UserBean();
System.out.println("getUserName="+userBean.getUserName());
System.out.println("getPassword="+userBean.getPassword());
return "goToWelcomePage";
}
but if i put the properies inside the action to be like this:
public String goToWelcome() throws Exception {
System.out.println("Second Success Action");
UserBean userBean=new UserBean();
System.out.println("getUserName="+this.getUserName());
System.out.println("getPassword="+this.getPassword());
return "goToWelcomePage";
}
it will works. please help i need to separate beans from controller as a best practice.