Hi Johannes ,
 Are you sure this code works ??

<code>

 String field1 = (String) PageA.get("field1");
 String textfield2 = (String) PageA.get("textfield2");
 .....
DynaActionForm PageB = (DynaActionForm)
session_automatic.getAttribute("PageB");
String textfield1 = (String) PageB.get("textfield1");
String textfield2 = (String) PageB.get("textfield2");

</code>


Have you checked the text field values ? I feel only one form would be
submited .

You shoud be using the form in "execute" method and I feel One action is
related to one form , so you would get only values of one form .

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

 RegistrationForm regform = (RegistrationForm) form;

}

----- Original Message -----
From: "johannes Schwarz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 25, 2004 4:13 PM
Subject: Set DynaActionForm to see values in textfields...(form-page)


> Hello,
>
> I have created more than one form-pages with struts. After validation i
> can read the values in the Action with:
>
> ---------
> HttpSession session = httpServletRequest.getSession(); DynaActionForm
> PageA = (DynaActionForm) session_automatic.getAttribute("PageA");
> //This is a DynaActionForm-Object in the Session
> String field1 = (String) PageA.get("field1");
> String textfield2 = (String) PageA.get("textfield2");
> .....
> DynaActionForm PageB = (DynaActionForm)
> session_automatic.getAttribute("PageB");
> String textfield1 = (String) PageB.get("textfield1");
> String textfield2 = (String) PageB.get("textfield2");
> .....
> ----------
>
> All works!
> Now i would like to edit one entry from the Database.
> So i have to define the Sessions and after the definition i go to the
> form-page. Than the fields must have the values from the Database.
>
> But this doesn't work!!
>
> My Code:
> -------
> HttpSession session = httpServletRequest.getSession(); DynaActionForm
> PageA = new DynaActionForm();
> PageA.set("textfield1","My Value....");
> PageA.set("textfield2","My Value....");
> ....
> DynaActionForm PageB = new DynaActionForm();
> PageB.set("textfield1","My Value....");
> PageB.set("textfield2","My Value....");
> ....
>
> //Define a DynaActionForm-Object in the session
> session.setAttribute("PageA", PageA);
> session.setAttribute("PageB", PageB);
> ---------
>
> This breaks at the line PageA.set().
> The ERROR is "java.lang.NullPointerException"
>
> Can you help me?
> Thanks!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to