struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zimmer, Robin (SSABSA)" <>
Subject RE: Creating a DynaActionForm instance
Date Thu, 29 Aug 2002 04:33:59 GMT
Try something like:

public ActionForward execute(ActionMapping mapping,
                             ActionForm form,
                             javax.servlet.http.HttpServletRequest request,
        throws java.lang.Exception
	  DynaActionForm myForm = (DynaActionForm)form;
        myForm.set("firstName", "bob");

        String forward = "success";
        ActionForward af = mapping.findForward( forward );
        return af;

-----Original Message-----
From: Aaron Lindsey []
Sent: Thursday, 29 August 2002 1:39 PM
Subject: Creating a DynaActionForm instance

Hi all,
   I've seen this question asked a couple of times in the archives, but
weren't any answers that I could find, so I'm giving it another shot.  How 
can I create an instance of DynaActionForm from inside an Action in order to

prepopulate it with data to be displayed in a jsp form?  I tried the 

DynaActionForm myForm = new DynaActionForm();
myForm.set("firstName", "bob");

A NullPointerException is thrown.  Is it possible to do something like this 
with a DynaActionForm?  Do I have to go back to the regular ActionForm to 
have the ability to create an instance of an ActionForm, populate it, put it

on the Request, and forward to a jsp that will then use the form?  Thanks.


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message