Re: re ading multiple selection of list box in freemarrker urgent
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Wednesday, May 20, 2009, 2:04:24 AM, darniz wrote:
>
> HI
> This drives me crazy, trying ot get multiple values for list box in
> freemarker.
> i have a list box where a user can select multiple values.
>
> on the receiving side i am using
> <# assign types=RequestParameters.type> and i am expecting type to have an
> array or some collection of user selected criteria, but that not happen when
> i try to print out type using
> ${types} i get only one value.
Looking into the source code it seems to me you can't do this... I
mean, not through "RequestParameters". RequestParameters use
HttpServletRequest.getParameter(), which returns the first value only,
according to the Servlet spec. It nowhere calls
HttpServletRequest.getParameterValues(). However, you shouldn't access
HTTP request parameters directly in an MVC template... The whole
RequestParameters thing was (is) an FreeMarker extension to serve
easier replacing of JSP with FTL in MVC-frameworks that only know JSP.
But JSP-s themselves can't 1:1 replaced with FTL-s, due to the
different approach... like in FTL you are discouraged from fiddling
the HTTP request.
Still, since we do give access to the HTTP parameters, it should be
done properly. Without breaking BC, that maybe means RequestParameters
should be callable to return a possibly empty list of parameter
values.
> whats teh correct way of doing this.
Don't access HTTP request, that has nothing to do with presentation
(V). Put the list into the FreeMarker data-model instead.
> Anybody let me know please
> Rashid
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects