Wendy,

If you're already playing around with this stuff, this may be old news. Just 
thought I'd add a couple of bits for posterity:

ServletRequest.getParameterMap does not appear to work for post requests (it 
returns an empty Map), only get requests (at least with Tomcat 4.1.14).

RequestUtils.populate requires the bean to be an instance of 
org.apache.struts.action.ActionForm for post requests. In addition, it looks 
like it requires that post requests pass through the Struts servlet (otherwise 
it throws an NPE).

Quoting Kris Schneider <[EMAIL PROTECTED]>:

> Right, BeanUtils.populate doesn't know anything about the world of servlets,
> so 
> it won't be of any help when parsing the request params.
> 
> Just a note that Struts also works with Servlet 2.2 containers, which predate
> 
> the availability of ServletRequest.getParameterMap.
> 
> Quoting Wendy Cameron <[EMAIL PROTECTED]>:
> 
> > Yes this is better, I was looking at much older JSP docs.
> > 
> > I think the functionality differences between
> ServletRequest.getParameterMap
> > and RequestUtils.populate could be multipart form content and file
> > updloading.
> > 
> > I had a look at the source and it seemed to handle multipart requests as
> > well
> > as standard ones.
> > 
> > I dont think bean utils would do this?
> > 
> > Regards Wendy
> > 
> > > -----Original Message-----
> > > From: Kris Schneider [mailto:kris@;dotech.com]
> > > Sent: Wednesday, November 13, 2002 3:21 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: jsp:setProperty
> > > 
> > > 
> > > Good call - but perhaps javax.servlet.ServletRequest.getParameterMap 
> > > would be better? HttpUtils is deprecated in Servlet 2.3. I'm 
> > > not really 
> > > sure what the functionality differences are betweem using 
> > > ServletRequest.getParameterMap and RequestUtils.populate...
> > > 
> > > Wendy Cameron wrote:
> > > > Isnt the conversion a simple matter of 
> > > > 
> > > > HashTable tbl = 
> > > javax.servlet.http.HttpUtils.parsePostData(int len, 
> > > ServletInputStream in)
> > > > Map map = new HashMap(tbl);
> > > > 
> > > > Only thin i am unsure about is the length parameter.
> > > > 
> > > > Regards Wendy
> > > > 
> > > > 
> > > >>-----Original Message-----
> > > >>From: Kris Schneider [mailto:kris@;dotech.com]
> > > >>Sent: Wednesday, November 13, 2002 1:40 PM
> > > >>To: Struts Users Mailing List
> > > >>Subject: Re: jsp:setProperty
> > > >>
> > > >>
> > > >>commons-beanutils.jar is part of the Struts 1.1 distribution. 
> > > >>It's also 
> > > >>an entirely independent Jakarta Commons component. I still 
> > > think you 
> > > >>should really check out the 
> > > >>org.apache.struts.util.RequestUtils.populate 
> > > >>method. Otherwise, you'll have to do the work of converting 
> > > >>the request 
> > > >>params into a Map that can be used by BeanUtils.populate.
> > > >>
> > > >>Wendy Cameron wrote:
> > > >>
> > > >>>Sorry but just let me get this clear in my head.
> > > >>>
> > > >>>There are BeanUtils class in commons.beanutils package.
> > > >>>This is not part of the struts distribution? Separate package?
> > > >>>So is it part of the latest tomcat distribution? (I think I 
> > > >>
> > > >>recall seeing
> > > >>
> > > >>>a commons jar file in the tomcat area)
> > > >>>
> > > >>>Regards Wendy
> > > >>>
> > > >>>
> > > >>>>-----Original Message-----
> > > >>>>From: Craig R. McClanahan [mailto:craigmcc@;apache.org]
> > > >>>>Sent: Wednesday, November 13, 2002 12:30 PM
> > > >>>>To: Struts Users Mailing List
> > > >>>>Subject: Re: jsp:setProperty
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>On Wed, 13 Nov 2002, Wendy Cameron wrote:
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>>Date: Wed, 13 Nov 2002 12:09:01 +1000
> > > >>>>>From: Wendy Cameron <[EMAIL PROTECTED]>
> > > >>>>>Reply-To: Struts Users Mailing List 
> > > >>>>
> > > >><[EMAIL PROTECTED]>
> > > >>
> > > >>>>>To: "Struts Users Mailing List (E-mail)" 
> > > >>>>
> > > >>>><[EMAIL PROTECTED]>
> > > >>>>
> > > >>>>>Subject: jsp:setProperty
> > > >>>>>
> > > >>>>>Hello All,
> > > >>>>>
> > > >>>>>This is probably not the best forum, but I was wondering if 
> > > >>>>
> > > >>>>anyone new how to, do the equivalent of
> > > >>>>
> > > >>>>
> > > >>>>>jsp:setProperty "*" in a servlet
> > > >>>>>
> > > >>>>>Or is this not possible?
> > > >>>>>
> > > >>>>
> > > >>>>Actually it is, and it's the basic reason that the BeanUtils 
> > > >>>>classes were
> > > >>>>created in the first place.  See the 
> > > BeanUtils.copyProperties() and
> > > >>>>BeanUtils.populate() methods -- Struts actually uses the 
> > > >>>>latter when it
> > > >>>>populates your form bean properties for you.  Javadocs are at:
> > > >>>>
> > > >>>> http://jakarta.apache.org/commons/beanutils/api/
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>>Regards Wendy
> > > >>>>>
> > > >>>>
> > > >>>>Craig
> > > >>>>
> > > >>>>
> > > >>>>--
> > > >>>>To unsubscribe, e-mail:   
> > > >>>
> > > >>><mailto:struts-user-unsubscribe@;jakarta.apache.org>
> > > >>>For additional commands, e-mail: 
> > > >>
> > > > <mailto:struts-user-help@;jakarta.apache.org>
> > > > 
> > > >>
> > > >>--
> > > >>To unsubscribe, e-mail:   
> > <mailto:struts-user-unsubscribe@;jakarta.apache.org>
> > >>For additional commands, e-mail:
> > <mailto:struts-user-help@;jakarta.apache.org>
> > > 
> > > 
> > 
> > -- 
> > Kris Schneider <mailto:kris@;dotech.com>
> > D.O.Tech       <http://www.dotech.com/>
> > 
> > 
> > --
> > To unsubscribe, e-mail:  
> > <mailto:struts-user-unsubscribe@;jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@;jakarta.apache.org>
> > 
> > 
> > --
> > To unsubscribe, e-mail:  
> > <mailto:struts-user-unsubscribe@;jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@;jakarta.apache.org>
> > 
> 
> 
> -- 
> Kris Schneider <mailto:kris@;dotech.com>
> D.O.Tech       <http://www.dotech.com/>
> 
> --
> To unsubscribe, e-mail:  
> <mailto:struts-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@;jakarta.apache.org>
> 


-- 
Kris Schneider <mailto:kris@;dotech.com>
D.O.Tech       <http://www.dotech.com/>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to