On Tue, 19 Nov 2002, Murray, Christopher wrote:

> Hey there guys n gals,
>
> I seem to be loosing a parameter of my request when I submit a multi-part
> form.

Yes, this is a bug. A fix is already in the works. Thanks for submitting
the bug report to Bugzilla.

--
Martin Cooper


>
> 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]>
>
>


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

Reply via email to