I am trying to ModelDriven in struts 2 but its not working
CustomerFormBean        is not filled with values i tried many techiques but
i cant get it fixed. It would be really helpful if any one fix this
thanks in advance.  The following is the sample of my code....

public class SignUpPersonalInformationAction  extends ActionSupport
implements ModelDriven, Preparable, ParameterAware
{
        /**
         *
         */
        private static final long serialVersionUID = 1L;
        private CustomerFormBean        signUpBean ;
        private Map<String, String[]> parameters;

        private String firstName ;

    public String execute()
    {
        PaymentDAO                                      paymentDAO              
=       new PaymentDAO();
        String  nextPage = "signup";
        HttpSession             session                         =
ServletActionContext.getRequest().getSession();
                HttpServletRequest      request                         =       
ServletActionContext.getRequest();
                UserView userView                                               
= (UserView)
session.getAttribute("userView");
                Map<String, String[]> formParametersMap                         
        = getParameters();

        if (userView != null )
        {
                nextPage = "renew";

        try {
                signUpBean.setFirstName(formParametersMap.get("firstName")[0]);
                signUpBean.setLastName(formParametersMap.get("lastName")[0]);
                signUpBean.setAddressLine1(formParametersMap.get("addressLine1")
[0]);
                signUpBean.setAddressLine2(formParametersMap.get("addressLine2")
[0]);
                signUpBean.setServices(formParametersMap.get("services"));
 
signUpBean.setCategoryTypeId(Integer.parseInt(formParametersMap.get("categoryTypeId")
[0]));
                signUpBean.setCity(formParametersMap.get("city")[0]);
                signUpBean.setState(formParametersMap.get("state")[0]);
                signUpBean.setPhone(formParametersMap.get("phoneNo")[0]);
                signUpBean.setZipCode(formParametersMap.get("zipCode")
[0].toString());
 
signUpBean.setCountry(paymentDAO.getCountryName(formParametersMap.get("country")
[0]));
                signUpBean.setCountryId(formParametersMap.get("country")[0]);


                }
        catch (Exception exp)
                {

                nextPage        =       "error";
                }
        request.setAttribute("signUpForm", signUpBean);
        session.setAttribute("customer", signUpBean);
        return nextPage;
    }

        public Object getModel() {
                return signUpBean;
        }

        public void setSignUpBean(CustomerFormBean signUpBean) {
                this.signUpBean = signUpBean;
        }

        public String getFirstName() {
                return firstName;
        }

        public void setFirstName(String firstName) {
                this.firstName = firstName;
        }

        public Map<String, String[]> getParameters() {
                return parameters;
        }
        public void setParameters(Map<String, String[]> param) {
                this.parameters = param;
            }

        public void prepare() throws Exception {
                signUpBean = new CustomerFormBean();

        }


In the above code i am getting form the request and setting it in the
bean which is not right..

-- 
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en

Reply via email to