File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes struts html:link Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts html:link" Watch "struts html:link" New topic

struts html:link

Kevin Devenney

Joined: Jul 31, 2002
Posts: 5
Does anyone know of any example or how to use the struts <html:link> when passing accross multiple parameters?
help would be much appriciated!
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
You can put your parameters in a map with the parameter name as the key and the parameter value as the value. i.e. if you want to link to
1) create your map somewhere
HashMap paramMap=new HashMap();
paramMap.put("x", "4");
paramMap.put("y", "2");
2) create your link
<html:link page="myJsp.jsp" name="paramMap" />
I haven't done this exactly so the syntax may not be exactly right on the link name. However, you can always use both name and property to get a property of a bean that is declared as a Map. i.e. have a bean with a getter
public Map getLinkParams() { return linkParams; }
I've used this in the past, and it works great.

"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The team, Newsletter 039.
I agree. Here's the link:
subject: struts html:link
jQuery in Action, 3rd edition