| Author |
passing parameters in jsp
|
varun bihani
Ranch Hand
Joined: Aug 11, 2003
Posts: 96
|
|
There are 2 methods for passing parameter among various JSP's. First is by use of hidden input type in the forms. Second one is use of beans(setter and getter methods) The problem with beans is these values expires after certain time.. I want to know which method is better....
|
<a href="http://www.galaxyweblinks.com" target="_blank" rel="nofollow">www.galaxyweblinks.com</a><br /><a href="http://www.freechatcode.com" target="_blank" rel="nofollow">www.freechatcode.com</a><br /><a href="http://www.onlinefamilytreemaker.com" target="_blank" rel="nofollow">www.onlinefamilytreemaker.com</a>
|
 |
Dave Vick
Ranch Hand
Joined: May 10, 2001
Posts: 3244
|
|
Varun I assume you are talking about passing parameters from one jsp to another, correct? Yes, you can it with values on a form (either hidden or visible) and with a bean (assuming it is scoped as anything other than page). Also, dont forget about the Session and application objects too!! They can be real handy for passing info that you might not neccesarily need to manipulat with a bean but want to have on hand to use. A good one would be the persons name so you could personalize each page, or an id retrieved from a DB, so you dont have to get it each time you need it. As far as which way is better than any other way it would all depend on what it is you need the piece of data to do, where you get the initial value from (user, DB, calculated), and how long you need it to be around. Hope that helps a little bit
|
Dave
|
 |
perry arora
Ranch Hand
Joined: Sep 18, 2003
Posts: 35
|
|
if the jsp'd are in the same context Use the application object(ServletContext) to store the values as name/value pairs and can access it across any no of jsp in the application. I agree that it depends on wat u wanna do!
|
 |
 |
|
|
subject: passing parameters in jsp
|
|
|