I'm trying to prepopulate a DynaForm with some values - right now just hard-coded, later should be taken from a DB. For that I'm using a SetupAction, that is called to prepopulate the form, insert it into the request and after that forward to the actual action for presenting the form to the user.

Looks like this:

public class MediaArchiveSetupAction extends Action {
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response){
ActionServlet servlet = this.getServlet();
MediaArchiveForm mediaArchiveForm = new MediaArchiveForm();
mediaArchiveForm.setServlet(this.getServlet());


         MessageResources messageResources = servlet.getInternal();

         mediaArchiveForm.set("author", "test");

// TODO: check why this doesn't work
request.setAttribute("mediaArchiveForm", mediaArchiveForm);
// this does actually work
request.setAttribute("test", "dummy");


         return (mapping.findForward("success"));
     }
}

Using this approach I always get a null pointer exception, leading me to the presumption that the actual form-object isn't built.

Any ideas why?

Thanks for any help,
Alexander


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



Reply via email to