Hallo,
what is the correct way to load data from db into form?

I have some form:
<html:form action="/FinishRegister" method="post" focus="registerFull">
    <table border="0">
      <tr>
        <td><bean:message key="register.name.Fullname" />:</td>
        <td><html:text property="fullname" /></td>
      </tr>
      <tr>
        <td><bean:message key="register.name.Mail" />:</td>
        <td><html:text property="mail" /></td>
      </tr>
etc...

,
action class as:
public class LoadDataAction extends Action {

  public ActionForward execute(ActionMapping mapping,
                                           ActionForm form,
                                           HttpServletRequest request,
                                           HttpServletResponse response)
                  throws Exception, DatabaseException
  {

      LoadDataService service = new LoadDataService();
      ComplRegisterDTO registerDTO = service.loadUser(request);
            ((DynaActionForm)form).set("registerFull", registerDTO);
            return (mapping.findForward("success"));
  }
}

Service class as:
public class LoadDataService {

public ComplRegisterDTO loadUser(HttpServletRequest request) throws Exception
{
ComplRegisterDTO userDataDTO = new ComplRegisterDTO();
HttpSession session = request.getSession();
User u = (User) session.getAttribute("user");
userDataDTO.setId(u.getUserId());
userDataDTO.setFullname(u.getFullname());
...
return userDataDTO;
}


and struts-config file:
       <action
          path="/Register2"
          type="cz.chalu.struts.modules.completeregister.LoadDataAction"
          parameter=".main.registerFinish"/>

But there is some mistake.
What is the correct way to do it?

Thanks, Jiri


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to