Hi All,

While developing an application in struts2 i am facing a strange problem
with one of my action namely RegsitrationAction.
i have a jsp page for user registration where there are certain fields for
the user to be filled for the registration purpose.
i have created a UserProfile bean class with the bean properties for all the
user registration fields.

in the Action class i am using Model Driven Approach for the Data Transfer
but my action execute method is being called 2 times and i am unable to
figure out the exact problem,but i can find the same data twice in the
database.below is the snapshot of my action calss as well as the Struts.xml
file for the Registration Process.

*ACTION CLASS

public class UserRegistration extends ActionSupport implements
ModelDriven<UserProfile> {

    /**
     *
     */
    private static final long serialVersionUID = 4619853901735738145L;
    private boolean status=false;
    public String execute()throws Exception{

        RegisterUser registerUser=new RegisterUser();
        status=registerUser.registerNewUser(userProfile);

        System.out.println("*******************Status is*************
"+status);
        if(status){
        return SUCCESS;
        }
        else{
            return INPUT;
        }
    }

    private UserProfile userProfile=new UserProfile();

    public UserProfile getModel(){
        return userProfile;
    }



}


Struts.xml

<action name="Register" class="actionsfolder.UserRegistration">
            <result name="success">/welcome/welcome.jsp</result>
            <result name="input">/registration/Registrer.jsp</result>

        </action>

Any help in this regard will be much appriciated..


Thanks in advance
-aum
*

Reply via email to