Hi Freddy,
Thanks. I'm actually not that keen on putting the collection in the
action-bean. The concept was to be able to easily create short-cut search
links anywhere on in my JSP pages without having to modify java code. The
links call the same action bean that my advanced search form (your typical
search form with checkboxes for criteria) calls.
Thanks for the suggestion on creating the collection with a JSP scriptlet.
I'll go with that for now although I'd love not to have to use a scriptlet
to accomplish this. Using stripes:param would be nicer.
I took a look at the stripes source and I see in this case it comes down the
fact that LinkTagSupport.addParameter(..) does a put operation on the
underlying hashmap which overwrites any previous parameters of the same
name. That could be changed to pull out the existing value for the key,and
if its not already a collection, create a new collection that contains the
current value, add the new value to the newly created collection and then
overwrite the key with the new collection. Now the parameter hashmap would
look the same as it would had a single stripes:param tag been used with a
collection.
I think this would be a more complete "add" operation. The addParameter is
really only doing an "update" when the key already exists in the hashmap.
Seems like a simple solution but I defer to the Stripes masters on wether it
should be done or not...
On Sat, Feb 21, 2009 at 10:15 PM, Freddy Daoud <[email protected]> wrote:
> Hi Ross,
>
> > I'm trying to use the stripes:link tag to produce a link that calls a
> > search event that handles multiple criteria. These links are essentially
> > shortcuts that perform common searches by enabling certain criteria (and
> > values) with URL parameters.
> >
> > <stripes:link ...>
> > <stripes:param name="searchRequest.criteria" value="foo"/>
> > <stripes:param name="searchRequest.criteria" value="bar"/>
> > ....
> > </stripes:link>
> >
> > This is not working quite the way I expected. The resulting URL only has
> > a single "searchRequest.criteria" parameter.
> >
> > Just wondered if this was a bug or expected behavior?
>
> I believe this is the expected behavior. To have multiple values for the
> same parameter name, you need to use one param tag and use a collection
> or array for the value.
>
> > Is there a way to create this collection on the fly with an EL
> > expression?
>
> My preference would be to obtain the collection from the action bean,
> but, off the top of my head, I would think you could create the
> values in the JSP with something like:
>
> <% request.setAttribute("values", new String[] {"foo", "bar"}); %>
> <stripes:link ...>
> <stripes:param name="searchRequest.criteria" value="${values}"/>
> </stripes:link>
>
> Hope that helps.
>
> Cheers,
> Freddy
> http://www.stripesbook.com
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
--
Ross Sargant
TVR Communications LLC
Software Engineer
3275 W Hillsboro Blvd,Suite 300,Deerfield Beach, Florida,33442
http://www.tvrc.com
p: 954-571-2017 x2108
email: [email protected]
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users