You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Otto, Till" <ti...@novadata.de> on 2000/09/12 09:33:54 UTC

struts:link tag

Hello!
I would like to display a list of items with hyperlinks to an "edit page"
for each line item.  Just like the subscription section in registration.jsp
of the struts-example application.

The example uses a custom tag for this purpose.  This seems to be an awful
lot of work for this common task, doesn't it?  The only alternative I found
is to use the "map feature" of the struts:link tag via the name and property
attributes. 

Wouldn't it be nice to have another attribute in the struts:link tag, e.g.
"param" that specified the property of a bean given in the name attribute?
The name and value of the specified property would then be appended to the
href of the hyperlink.
Like this:

<struts:link href="editSubscription.do" name="subscription" param="id">
My subscription</struts:link>

If a subscription bean with a property "id" existed and id's value were
1001, this would evaluate to

<a href="editSubscription.do?id=1001">
My subscription</a>


Does this make sense? Hope it wasn't too confusing. 
-Till


Re: struts:link tag

Posted by James Strachan <ja...@metastuff.com>.
struts:link tagHi Till

I sent a patch to the struts-dev list to do exactly that. Here are the mails
with a patch to do as you need

http://archive.covalent.net/jakarta/struts-dev/2000/09/0004.xml
http://archive.covalent.net/jakarta/struts-dev/2000/09/0003.xml

Regards
James

James Strachan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
web: http://www.metastuff.com
mail: james@metastuff.com

----- Original Message -----
From: Otto, Till
To: 'struts-user@jakarta.apache.org'
Sent: 12 September 2000 08:33
Subject: struts:link tag


Hello!
I would like to display a list of items with hyperlinks to an "edit page"
for each line item.  Just like the subscription section in registration.jsp
of the struts-example application.
The example uses a custom tag for this purpose.  This seems to be an awful
lot of work for this common task, doesn't it?  The only alternative I found
is to use the "map feature" of the struts:link tag via the name and property
attributes.
Wouldn't it be nice to have another attribute in the struts:link tag, e.g.
"param" that specified the property of a bean given in the name attribute?
The name and value of the specified property would then be appended to the
href of the hyperlink.
Like this:
<struts:link href="editSubscription.do" name="subscription" param="id">
My subscription</struts:link>
If a subscription bean with a property "id" existed and id's value were
1001, this would evaluate to
<a href="editSubscription.do?id=1001">
My subscription</a>


Does this make sense? Hope it wasn't too confusing.
-Till