Can anyone tell me whether its better to use Action form variables or variables in session when we want to transfer data between Action class and JSP? Also please list the advantages of using either one of them. Thanks in advance.
What Action form variables??? Are you talking about Struts here?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
I prefer to use variables defined on my action form. At a minimum this gives the JSP developer a place to look up the name of the properties. Also, if I had a value in my Action that I needed to display on my jsp I would store it in the request before I stored it in session.
well a normal ActionForm or ValidatorForm is like a pojo, all the simple variables should be type String , the common scope is request
but you can create special variables with scope session before load a jsp (maybe a list for a html:select), why?, because if you working with validation and detects any error, its create a new request and lost the variable that represents a List, of course that you have a variable or property that represents the value selected of the List (i had this problem if i dont use session scope for the list)
if exist another better way, please let me know
Regards Manuel [ October 08, 2006: Message edited by: Manuel Jordan ]
kill your pride, share your knowledge with all
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop