You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nathan Maves <Na...@Sun.COM> on 2004/01/14 17:53:44 UTC
best way to use multiple parameters with html:link tags
I have a collection of objects that I am interating over in my jsp. I
would like to create links to another action with a few of the
properties of the beans in the collection. From the docs I see that
you have to use a java.util.Map if you want to have multiple params on
a html:link tag. Is there no other way then creating a map for each
iteration of my collection?
Nathan
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: best way to use multiple parameters with html:link tags
Posted by Kris Schneider <kr...@dotech.com>.
Because the "std" tags are, well, standard? ;-) Seriously, all things being
equal (and it's not always obvious when they are), I opt for JSTL because it's
now a standard and its expression language has been incorporated into the JSP
2.0 spec. A tag like <html:link> can't be replaced by JSTL because it can make
direct use of the framework ("action" and "forward" attributes), it's not just a
"utility" tag.
Quoting Nathan Maves <Na...@Sun.COM>:
> Looks like this will work! Is there any reason to use the std tags vs
> the struts tags? (i.e. forEach vs iterate)
>
> ~N
> On Jan 14, 2004, at 10:03 AM, Kris Schneider wrote:
>
> > It's not too big a deal, just reuse a single map with JSTL:
> >
> > <jsp:useBean id="paramMap" class="java.util.HashMap"/>
> > <c:forEach var="bean" items="${beans}">
> > <c:set target="${paramMap}" property="prop1" value="${bean.prop1}"/>
> > <c:set target="${paramMap}" property="prop2" value="${bean.prop2}"/>
> > <c:set target="${paramMap}" property="prop3" value="${bean.prop3}"/>
> > <html:link action="/foo" name="paramMap">...</html:link>
> > </c:forEach>
> >
> > Quoting Nathan Maves <Na...@Sun.COM>:
> >
> >> I have a collection of objects that I am interating over in my jsp. I
> >> would like to create links to another action with a few of the
> >> properties of the beans in the collection. From the docs I see that
> >> you have to use a java.util.Map if you want to have multiple params on
> >> a html:link tag. Is there no other way then creating a map for each
> >> iteration of my collection?
> >>
> >> Nathan
> >
> > --
> > Kris Schneider <ma...@dotech.com>
> > D.O.Tech <http://www.dotech.com/>
--
Kris Schneider <ma...@dotech.com>
D.O.Tech <http://www.dotech.com/>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: best way to use multiple parameters with html:link tags
Posted by Nathan Maves <Na...@Sun.COM>.
Looks like this will work! Is there any reason to use the std tags vs
the struts tags? (i.e. forEach vs iterate)
~N
On Jan 14, 2004, at 10:03 AM, Kris Schneider wrote:
> It's not too big a deal, just reuse a single map with JSTL:
>
> <jsp:useBean id="paramMap" class="java.util.HashMap"/>
> <c:forEach var="bean" items="${beans}">
> <c:set target="${paramMap}" property="prop1" value="${bean.prop1}"/>
> <c:set target="${paramMap}" property="prop2" value="${bean.prop2}"/>
> <c:set target="${paramMap}" property="prop3" value="${bean.prop3}"/>
> <html:link action="/foo" name="paramMap">...</html:link>
> </c:forEach>
>
> Quoting Nathan Maves <Na...@Sun.COM>:
>
>> I have a collection of objects that I am interating over in my jsp. I
>> would like to create links to another action with a few of the
>> properties of the beans in the collection. From the docs I see that
>> you have to use a java.util.Map if you want to have multiple params on
>> a html:link tag. Is there no other way then creating a map for each
>> iteration of my collection?
>>
>> Nathan
>
> --
> Kris Schneider <ma...@dotech.com>
> D.O.Tech <http://www.dotech.com/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: best way to use multiple parameters with html:link tags
Posted by Kris Schneider <kr...@dotech.com>.
It's not too big a deal, just reuse a single map with JSTL:
<jsp:useBean id="paramMap" class="java.util.HashMap"/>
<c:forEach var="bean" items="${beans}">
<c:set target="${paramMap}" property="prop1" value="${bean.prop1}"/>
<c:set target="${paramMap}" property="prop2" value="${bean.prop2}"/>
<c:set target="${paramMap}" property="prop3" value="${bean.prop3}"/>
<html:link action="/foo" name="paramMap">...</html:link>
</c:forEach>
Quoting Nathan Maves <Na...@Sun.COM>:
> I have a collection of objects that I am interating over in my jsp. I
> would like to create links to another action with a few of the
> properties of the beans in the collection. From the docs I see that
> you have to use a java.util.Map if you want to have multiple params on
> a html:link tag. Is there no other way then creating a map for each
> iteration of my collection?
>
> Nathan
--
Kris Schneider <ma...@dotech.com>
D.O.Tech <http://www.dotech.com/>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org