struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Koivisto <markus.koivi...@navielektro.fi>
Subject Re: [struts-faces] Empty Form in Action
Date Fri, 20 May 2005 17:26:05 GMT

>>Now, the action is executed all right, but the form that is sent to the 
>>action is completely empty. Every field is null.  Does anyone have any 
>>idea why this happens and how to fix it?
>>
>>    
>>
>
>It sounds like you are not returning an ActionForward from your action execute method.
 Make sure that you have a forward configured under your action or a global forward.  Returning
null will result in a blank page.
>  
>
Yes. Returning a null forward will  result in a blank page. However, 
that's not what's happening. The Action does return a forward. What's 
happening is that the Servlet apparently creates a new ActionForm object 
that is empty instead of using the one tha user filled in. For clarity, 
the action looks something like this:

<action path="/event" type="com.acme.MyAction">
    <forward name="success" path="/event.faces" />
</action>          

public ActionForward execute(ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response) {
    log.info(((EventForm)form).getDesc());
 
    return mapping.findForward("success");
}

No matter what the user writes, the log will show that the the string is 
null.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message