Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

how to send parameter in <html:link> tag

Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
Say you have a hyperlink list that's built in a loop. The number of items in the list can vary based on the records in the database use to build the list. The text for each link is created based on a database lookup.
Each element in the list has it's own personnel information. Clicking on any of the links in the list would take you to another JSP page, where I want to display "Detail" information for the link clicked in the previous JSP page.
Therefore, my (basic?) question is how can you send the next JSP page specific information about the link that was clicked to call it?
I have code in jsp like:

List<SelectForm> list=(List<SelectForm>)request.getAttribute("list");
Iterator ir =list.iterator();
<table cellpadding="1" cellspacing="1" border="1" align="left" style="font-family: cursive;">
<tr style="color: maroon;"><th bgcolor="Pink" style="width: 100px;"> Firstname </th><th bgcolor="Pink" style="width: 100px;"> Lastname </th><th bgcolor="Pink" style="width: 100px;"> Country </th><th bgcolor="Pink" style="width: 200px;"> EmailId </th></tr>
<%= sf.getFirstname() %>
<%= sf.getLastname() %>
<%= sf.getCountry() %>
<html:link action="/information" onfocus="focus()"><font color="#00FF00">
<%= sf.getEmailid() %></font></html:link>
here sf.getemailid() is in link form.

Thanks in advance for any ideas.
Pawan Singh
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the solution by my own
you just have to set the object in pagecontext.setattribute(String arg0, Object arg1)
then <html:link action="......" paramid="XXX" paramName="String arg0"/>

you can retrieve this parameter in your action class as :

here in code view:

<%String mail=sf.getEmailid();

<html:link action="/information" onfocus="focus()" paramId="mailid" paramName="emailid" scope="request"><font color="#00FF00">

<%= sf.getEmailid() %></font></html:link></td>

here sf.getEmailid() is a String type Object which i have to pass as a parameter from a jsp to action class in link form.
hope you like this , and definetly it will work.
I got this tall by not having enough crisco in my diet as a kid. This ad looks like it had plenty of shortening:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!