Im rather in agreement. It really should parse the request parameters before
reset is called so they are available to the reset method. I suppose I
should try and find time to log it in bugzilla. Christopher - you got time
to log it as a bug?

-----Original Message-----
From: Murray, Christopher [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 23:50
To: 'Struts Users Mailing List'
Subject: RE: Loosing my parameter in the multipart request


what if you wanted to retrieve a request parameter for a branch in your
reset method ?

-----Original Message-----
From: Kris Schneider [mailto:[EMAIL PROTECTED]]
Sent: 19 November 2002 15:55
To: Struts Users Mailing List
Subject: RE: Loosing my parameter in the multipart request


Sure, but that's just the normal flow of form processing:

reset -> populate -> validate

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

> It would also appear that the request parameters are only revealed once
the
> ActionForm has been populated.
>
> i.e.  my reset method exploded but when I commented it out the validate
> worked fine.
>
> -----Original Message-----
> From: Kris Schneider [mailto:[EMAIL PROTECTED]]
> Sent: 19 November 2002 13:39
> To: Struts Users Mailing List
> Subject: Re: Loosing my parameter in the multipart request
>
>
> 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]>
>
> --
> 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]>

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