In a recent
project, we had to face quite often the fact that we wanted to use a
<html:link> tag with multiple request parameters. I know that this tag
allows the use of a Map with all the parameters. However, we found its usage
quite difficult specially when the <html:link<> tag was embedded in a
<logic:iterate> tag and when the request parameters were
dynamic.
So I write an
extension to the <html:link> tag so that we can add parameter tags in its
body. Actually, I have rewrite the <html:link> tag because the new tag had
to extend BodyTagSupport and not TagSupport.
I have hereby
attached both tags (the link tag and the linkparam tag) if somebody is
interested. I let you decide to put them in the standard Struts core
functionality (I would be very happy :-))) ).
The link tag works
exactly the same as the standard struts tag. The linkparam tag does not include
the Struts philosophy (I mean being able to refer directly to a bean and its
properties for the value) but the attributes could be computed at
runtime.
Here is an example
(too simple to be representative) of use:
<hm:link
href="request.do">
<hm:paramlink name="action" value="read" />
<hm:paramlink name="docref" value="55363" />
This is the link for the request.
</hm:link>
Eric