You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marcus Biel <Ma...@bmw.de> on 2002/11/05 13:49:23 UTC

How to fill an Actionform after using an ActionClass ?

How to fill an Actionform after using an ActionClass ?


Normally a user fills out a form on a jsp, then the Actionform gets
called and filled by the data the user entered.
Then the ActionClass gets started and uses the data from the ActionForm.

But I've got an Action that creates data, and it needs to get saved in
the ActionForm.

How can this be done ???


thx,

marcus

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to fill an Actionform after using an ActionClass ?

Posted by Mark Ayad <ma...@javamark.com>.


Just call the setters ! look also at the thread prepopulation earlier this
week


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

editForm.setTitle("title value");

editForm.setDetails("detail value");

return mapping.findForward("success");

}

----- Original Message -----
From: "Marcus Biel" <Ma...@bmw.de>
To: <st...@jakarta.apache.org>
Sent: Tuesday, November 05, 2002 1:49 PM
Subject: How to fill an Actionform after using an ActionClass ?


> How to fill an Actionform after using an ActionClass ?
>
>
> Normally a user fills out a form on a jsp, then the Actionform gets
> called and filled by the data the user entered.
> Then the ActionClass gets started and uses the data from the ActionForm.
>
> But I've got an Action that creates data, and it needs to get saved in
> the ActionForm.
>
> How can this be done ???
>
>
> thx,
>
> marcus
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to fill an Actionform after using an ActionClass ?

Posted by Marcus Biel <Ma...@bmw.de>.
hmmm.

Tried it this way:

AlaskaGroupsForm alaskaGroupsForm = (AlaskaGroupsForm)form;

alaskaGroupsForm.setGid(gid);
alaskaGroupsForm.setBeschreibung(beschreibung);
alaskaGroupsForm.setStiwo(stiwo);
alaskaGroupsForm.setMo(mo);
alaskaGroupsForm.setStiwoerg(stiwoerg);
alaskaGroupsForm.setOrg1(org1);
alaskaGroupsForm.setOrg2(org2);

But my form in my jsp still doesn't get populated by all properties.
The only property that gets filled is "gid" and that one is filled
automatically from my first jsp using the regular ActionForm.
It seems as if I am creating a new instance of the action form in my
ActionClass istead of using the existing ActionForm.


idea ideas ?

marcus


mark@javamark.com schrieb:
> 
> Just call the setters ! look also at the thread prepopulation earlier this
> week
> 
> public ActionForward execute(ActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response) throws Exception
> {
> EditForm editForm = (EditForm)form;
> 
> editForm.setTitle("title value");
> 
> editForm.setDetails("detail value");
> 
> return mapping.findForward("success");
> 
> }

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>