File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes using html:link to pass parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "using html:link to pass parameter" Watch "using html:link to pass parameter" New topic
Author

using html:link to pass parameter

prakash chauhan
Ranch Hand

Joined: Jun 22, 2007
Posts: 81
Hi,
I wanted to use <html:link>
where user clicks on the link and an actiod would be called and would recieve a parameter
Here is what my <html:link> looks like (ViewTeamUpdates.jsp):


The attribute TEAMUPATESLIST is a request Attribute which holds an ArrayList of 'teamUpdate' which has msg_id property.

if i use only:

i do get the value of the msg id
but when used in conjunction with <html:link> it gives me following error:


which the row and column are near the paramName attribute.

Could somebody tell me what am i doing wrong.?

-Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The problem here is that you can't use one custom tag as an attribute for another as you're attempting to do by using a bean:write tag for an attribute of an html:link tag.

In this case you can do what you need to do quite easily without embedding tags. Just use a combination of the paramName and paramProperty attributes instead of the paramValue attribute. Example:

[ March 07, 2008: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
prakash chauhan
Ranch Hand

Joined: Jun 22, 2007
Posts: 81
Hey Merrill
Thanks for the solution ,
its working now..
i was using it that way because i had seen it working in conjuction with
<a href="/edit.do?msgId=<bean:write...../>"></a> tag and was working on that lines..
I do appreicate your help.
varun.. sh
Greenhorn

Joined: Jan 22, 2008
Posts: 1
I am struggling with a similar problem.

I am able to call my action file like this
<html:link action="/downloadMyFile" >Click Here</html:link>

I tried your way that you have discussed but i am struggling how to pass parameters values to my action class.

It will be great if you can send your sample jsp.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Post your code along with a description of the problem, error messages, etc., and we'll help you debug it.
 
wood burning stoves
 
subject: using html:link to pass parameter
 
Similar Threads
using EL function
How to use Bean:define
request parameter set in html:link showing the classname instead of value
Passing parameters
Bean-based hyperlink not working