Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to send variable value through <html:link> tag

 
Aniket Khadke
Greenhorn
Posts: 29
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my application I am displaying list of students. And when user clicks on student's name, his profile should be displayed. For this I want to send students name with the url. How can I do that?
Thanks..
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Aniket,

If using html:link is the only option you are looking for then,
1. use "href/onclick" attribute to set the URL and append the values to the URL (not secure but works with/without java script browser)
2. use "href/onclick" attribute to call javascript method and pass this value as method parameter and submit the action in javascript.

 
Sandy Chatterjee
Ranch Hand
Posts: 55
Hibernate Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Aniket,

Assuming the name of the ActionForm is 'StudentsForm' which has a student object.
The 'student' object contains 'studentName' as one of its property.
'stud' is the scripting variable in the <logic:iterator> tag.
Now, when the user clicks on the name of the student (defined in <bean:write> tag) the 'passStudentName' action is fired taking studentName as the value of the request parameter. And note that (paramId="name") 'name' of the request parameter.
So, in your ActionForm you should have a field called 'name' which will hold the value passed by the request parameter(i.e studentName).

If you have any problem in understanding the above one reply me back.

Regards,

Sandy
 
Aniket Khadke
Greenhorn
Posts: 29
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandy Chatterjee wrote:Hi Aniket,

Assuming the name of the ActionForm is 'StudentsForm' which has a student object.
The 'student' object contains 'studentName' as one of its property.
'stud' is the scripting variable in the <logic:iterator> tag.
Now, when the user clicks on the name of the student (defined in <bean:write> tag) the 'passStudentName' action is fired taking studentName as the value of the request parameter. And note that (paramId="name") 'name' of the request parameter.
So, in your ActionForm you should have a field called 'name' which will hold the value passed by the request parameter(i.e studentName).

If you have any problem in understanding the above one reply me back.

Regards,

Sandy



Hi Sandy,
Code worked like a champ... thanks.. :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic