You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Steven Nakhla <sd...@yahoo.com> on 2004/01/21 18:18:27 UTC

html:link with multiple parameters

I have a web app that performs a search and returns the results in a Java Collection.  I then use logic:iterate to display the returned results.  What I would like to add, though, is the ability to edit the returned results.
 
I have an ActionServlet that does security checking and such, and a parameter is passed in to specify the action to take.  For example, the url would look like:  http://mypage/mycontroller?action=new or http://mypage/mycontroller?action=edit.  My question is, how can I iterate through my returned results and create html:links that result in urls that look like this:  http://mypage/mycontroller?action=edit&id=12345?
 
I know html:link has parameter properties, but those seem to specify only one parameter.  In my case, I need to specify 2 (the value for action and the value for id), one of which is dynamic depending on the search results.  Any advice?
 
Thanks in advance!
Steve Nakhla


---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes

Re: html:link with multiple parameters

Posted by Brad Balmer <bb...@peapod.com>.
Look at

http://struts.sourceforge.net/community/taglibs.html

LinkParam Tag

Steven Nakhla wrote:

>I have a web app that performs a search and returns the results in a Java Collection.  I then use logic:iterate to display the returned results.  What I would like to add, though, is the ability to edit the returned results.
> 
>I have an ActionServlet that does security checking and such, and a parameter is passed in to specify the action to take.  For example, the url would look like:  http://mypage/mycontroller?action=new or http://mypage/mycontroller?action=edit.  My question is, how can I iterate through my returned results and create html:links that result in urls that look like this:  http://mypage/mycontroller?action=edit&id=12345?
> 
>I know html:link has parameter properties, but those seem to specify only one parameter.  In my case, I need to specify 2 (the value for action and the value for id), one of which is dynamic depending on the search results.  Any advice?
> 
>Thanks in advance!
>Steve Nakhla
>
>
>---------------------------------
>Do you Yahoo!?
>Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
>  
>


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


RE: html:link with multiple parameters

Posted by Richard Hightower <rh...@arc-mind.com>.
html:link has a name attribute.

Set the name to a Map (e.g. HashMap)....

demo as follows: (syntax may be off)

<jsp:useBean id="params" class="java.util.HashMap" />

<%
params.put("action","edit");
params.put("id","12345");
%>

<html:link action="edit" name="params"/>


Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring
-----Original Message-----
From: Steven Nakhla [mailto:sdnakhla@yahoo.com]
Sent: Wednesday, January 21, 2004 10:18 AM
To: Struts
Subject: html:link with multiple parameters


I have a web app that performs a search and returns the results in a Java
Collection.  I then use logic:iterate to display the returned results.  What
I would like to add, though, is the ability to edit the returned results.

I have an ActionServlet that does security checking and such, and a
parameter is passed in to specify the action to take.  For example, the url
would look like:  http://mypage/mycontroller?action=new or
http://mypage/mycontroller?action=edit.  My question is, how can I iterate
through my returned results and create html:links that result in urls that
look like this:  http://mypage/mycontroller?action=edit&id=12345?

I know html:link has parameter properties, but those seem to specify only
one parameter.  In my case, I need to specify 2 (the value for action and
the value for id), one of which is dynamic depending on the search results.
Any advice?

Thanks in advance!
Steve Nakhla


---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes


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