If the request content type isn't application/x-www-form-urlencoded, then the
getParameter family of methods won't work. However, I'm guessing that Struts
will handle this for you if you make userAction a property on an ActionForm.
Your app logic may need to change in that case since Struts will populate the
form *after* reset has been called. In other words, you'd do something like this
in your Action:

UploadForm upload = (UploadForm)form;
if (Constants.STAGE_ACTION_METHOD.equals(upload.getUserAction())) {
...
}

Quoting "Murray, Christopher" <[EMAIL PROTECTED]>:

> Hey there guys n gals,
> 
> I seem to be loosing a parameter of my request when I submit a multi-part
> form.
> 
> In the page I have a,
> 
> <input type="hidden" name="userAction"/>
> 
> this is written to by a call to,
> 
> <a
> href="javascript:submitFormDispatch('UploadForm','performUpload')">LINK</a>
> 
> which calls,
> 
>       function submitFormDispatch( formname, value )
>       {
>               var form = document.forms[ formname ];
>               var elements = form.elements;
> 
>               elements[ 'userAction' ].value = value;
>               alert("userAction =" + value);
>               form.submit();
>       }
> 
> Now I know this is working because the alert pops up to tell me.
> 
> When the reset method is called in the ActionForm I get a null pointer
> exception because no parameter is found for the action mapping set in the
> struts-config.xml,
> 
>         <action path="/.../upload"
>                 type="com...UploadAction"
>                 name="UploadForm"
>                 scope="session"
>                 validate="true"
>                 input="/.../upload.jsp"
>                 parameter="userAction">
>             <forward name="displayInputForm"
> path="/.../upload.jsp"></forward>
>             <forward name="confirmUpload"
> path="/.../Upload_confirmed.jsp"></forward>
>             <forward name="fail" path="/.../error"/>
>         </action>
> 
> And then in the form I've been using,
> 
>     public void reset(ActionMapping mapping, HttpServletRequest request){
> 
>         FWLog log = FWLogManager.getLog("UploadActionForm");
>         log.debug("Entering UploadActionForm.reset");
> 
>         System.out.println("mapping.getParameter() = " +
> mapping.getParameter());
>         System.out.println("request.getParameter(mapping.getParameter()) =
> ");
>         System.out.println(request.getParameter(mapping.getParameter()));
> 
>         System.out.println("request = " + request.toString());
> 
>         if
> (request.getParameter(mapping.getParameter()).equals(Constants.STAGE_ACTION_
> METHOD)){
> 
>             this.emailText = null;
>             contactId = null;
>             log.debug("email text has been reset.");
>         }
> 
>         log.debug("Entering UploadActionForm.reset");
>     }
> 
> When all this executes this outputs
> 
> mapping.getParameter() = userAction
> request.getParameter(mapping.getParameter()) =
> null
> request = org.apache.struts.upload.MultipartRequestWrapper@799ca4
> 
> java.lang.NullPointerException
>         at com...web.action.UploadActionForm.reset(Unknown Source)
> 
> Guessing that a Multipart request is a different request object.
> 
> Have you got any suggestions ?
> 
> Is this possible ?
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

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

Reply via email to