struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject Re: <html:link with several dynamic parameters
Date Mon, 04 Nov 2002 18:29:55 GMT
Of course, you can always combine approaches:

<jsp:useBean id="paramMap" class="java.util.HashMap"/>
<c:set target="${paramMap}" property="p1" value="v1"/>
<c:set target="${paramMap}" property="p2" value="v2"/>
<html:link forward="foo" name="paramMap"/>

But in reality, I'd be more likely to create and populate the Map in an Action 
that fronts the JSP. The Map would either end up as a scoped attribute or as a 
property on an ActionForm or some other bean. I don't consider that much of a 
pain and there's certainly no scriptlet code.

One other thing to consider about Map vs. <c:param> tags is direct support for 
multi-valued parameters. You can dump a String[] into a Map value and 
<html:link> will use it to produce a request parameter (whose name is the Map 
key) for each array element. You'd have to use multiple <c:param> tags with the 
same name attribute to accomplish something similar. I'd love to see <c:param> 
incorporate that functionality, maybe I'll submit an RFE...

Quoting David Graham <dgraham1980@hotmail.com>:

> Yes, the ability to specify an ActionForward is nice but not enough to make
> 
> me use <html:link>.  The <c:param> tags are better than using a map because
> 
> you don't have to write scriptlet code to initialize the map (you could 
> init. the map in other places but it's still a pain).  It's more efficient 
> and clearer to specify individual param elements.
> 
> David
> 
> 
> >From: Kris Schneider <kris@dotech.com>
> >Reply-To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
> >To: Struts Users Mailing List <struts-user@jakarta.apache.org>
> >Subject: Re: <html:link with several dynamic parameters
> >Date: Mon,  4 Nov 2002 10:14:47 -0500
> >
> >Just a note that <html:link> provides some Struts-specific features that 
> >may
> >make you think twice before converting to JSTL's <c:url>:
> >
> >Ability to specify a global ActionForward.
> >
> >Transactional control token support.
> >
> >Works with a JSP 1.1 container (okay, so that's not Struts-specific).
> >
> >I'm also curious why you'd say that <c:param> tags are much better than a 
> >Map
> >for handling multiple patameters.
> >
> >Quoting David Graham <dgraham1980@hotmail.com>:
> >
> > > You need to use the Map feature to include more than one parameter.  I
> > > suggest using the JSTL's <c:url> tag instead.  That tag is standard and
> > > handles multiple parameters much better than <html:link>
> > >
> > > David
> >
> >--
> >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>
> 
> 
> _________________________________________________________________
> Get faster connections -- switch to MSN Internet Access! 
> http://resourcecenter.msn.com/access/plans/default.asp
> 
> 
> --
> 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>


Mime
View raw message