aspose file tools*
The moose likes JSF and the fly likes Passing values to JSp with href Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Passing values to JSp with href" Watch "Passing values to JSp with href" New topic
Author

Passing values to JSp with href

Rohit Kumar
Ranch Hand

Joined: Jul 19, 2007
Posts: 35
I have 2 jsp�s (First.jsp, second.jsp).
I have one a:href on First.jsp where it goes to Second.jsp , and also it needs to take some ID values from First.jsp to Second.jsp.

Below is my code (First.jsp):
<h:inputHidden id =�employeeId� value = �#{employee.employeeID}�
<h:inputHidden id =�applicationId� value = �#{employee.appliationID}�
Below iy my href:
<a href = �/jsp/Second.jsp� > Add Application </a>

How can I send values of employeeId and applicationID to Second.jsp , on clicking Add Application on first.jsp
Any suggestions
Thanks..
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Rahul Gosh:

<h:inputHidden id =�employeeId� value = �#{employee.employeeID}�
<h:inputHidden id =�applicationId� value = �#{employee.appliationID}�


These aren't standard HTML or JSP tags.
What framework/library are you using?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Rohit Kumar
Ranch Hand

Joined: Jul 19, 2007
Posts: 35
am Using JSF
Shailesh Kini
Ranch Hand

Joined: Oct 17, 2001
Posts: 153
Rahul,

You can either submit the form with the 2 fields to your second.jsp or call a javascript function onClick of your anchor link, add fields as querystring and then pass the queryString to your second.jsp. Your second jsp will get the values as request parameters.
[ August 17, 2007: Message edited by: Shailesh Kini ]

Shailesh Kini.
Ronald Aguilar
Greenhorn

Joined: Sep 14, 2004
Posts: 21
you can still used the standard foward and redirect


Ron
Rohit Kumar
Ranch Hand

Joined: Jul 19, 2007
Posts: 35
Thnx for suggestions Shailesh..

Do you have any code for example ..

Thanks
Denise Smith
Ranch Hand

Joined: Jul 26, 2005
Posts: 36
Are you using an IDE? If so which one??


Surround yourself with learners...They will educate you!
Rohit Kumar
Ranch Hand

Joined: Jul 19, 2007
Posts: 35
Elipse 3.1
Sushma Sharma
Ranch Hand

Joined: Jun 02, 2005
Posts: 139
use this.

Rohit Kumar
Ranch Hand

Joined: Jul 19, 2007
Posts: 35
Thanks Sushma for the sample. If I pass appId, how can I print this appId on the next screen.


Thanks,
Rahul
Sushma Sharma
Ranch Hand

Joined: Jun 02, 2005
Posts: 139
you can get the values of parameter like this


where employeeId is the name of the parameter.
A. Dusi
Ranch Hand

Joined: Sep 27, 2004
Posts: 114
What is the scope of your employee bean? If it is in session scope, the employeeId and appId are automatically available in your second jsp. You can refer these properties in the same way as you referred them in your first jsp.
Rohit Kumar
Ranch Hand

Joined: Jul 19, 2007
Posts: 35
I am using request scope. Thannks for your tip to keep in session scope.
 
 
subject: Passing values to JSp with href