Yep. Thats what he is using. Struts is kind enough to provide the request
wrapper object that will provide the parameters , but it doesnt populate it
until after reset() is called.
It would be far more useful if it did it earlier (IMHO at the start of
request processing!).

-----Original Message-----
From: Kris Schneider [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 00:56
To: Struts Users Mailing List
Subject: RE: Loosing my parameter in the multipart request


Just to clarify, your specific situation violates #3. The content type of
your
request is multipart/form-data, right?

Quoting Kris Schneider <[EMAIL PROTECTED]>:

> Sure, you can do anything with the request object you want. The caveat is
> that
> the getParameter methods will only work if the requirements of the
> following
> section of the 2.3 spec have been met:
>
> SRV.4.1.1 When Parameters Are Available
>
> The following are the conditions that must be met before post form data
will
> be
> populated to the parameter set:
>
> 1. The request is an HTTP or HTTPS request.
> 2. The HTTP method is POST
> 3. The content type is application/x-www-form-urlencoded
> 4. The servlet has made an initial call of any of the getParameter family
> of
> methods on the request object.
>
> If the conditions are not met and the post form data is not included in
the
> parameter set, the post data must still be available to the servlet via
the
> request object’s input stream. If the conditions are met, post form data
will
> no
> longer be available for reading directly from the request object’s input
> stream.
>
> Quoting "Murray, Christopher" <[EMAIL PROTECTED]>:
>
> > 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]>
> >
>
>
> --
> 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]>
>


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

Reply via email to