This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am new to Struts and I just finished some code for my project. I have some questions regarding the preformance issues.
1) I have an action class , with many ActionForward classes. To pass some variables between these classes I am using session Variable. Is this a good way to program, or should i use a public variable to pass data between these classes.
2)I am using lot of session variables to pass arraylists to the JSP page from my code. Is this a good way to program?
Meera, I think your question is A Action class with Many ActionForward (Not ActionForard classes)
Joined: Jun 30, 2005
Regarding my First Question, 1) I have an action class , with many ActionForward classes. To pass some variables between these classes I am using session Variable. Is this a good way to program, or should i use a public variable to pass data between these classes.
Does anybody have any suggestions.
Joined: Dec 27, 2001
Do you mean to say that you have many forwards in one action class? I could understand "ActionForward classes".
Now I want to pass some variables from class 'abc' to 'def'. I am already passing these variables to the jsp page as session variables. so Should i use those session variables to get values inthe 'def'calss. or use public variables.
Joined: Dec 27, 2001
Meera, 'abc' and 'def' are two different action methods in one Action class. Each method have its own ActionForward. If you forward to "abc" and kept some values in session, you can just use them in any number of jsp's as long as the session is valid.You don't have to create any public variables to hold the data.It is also not thread safe.
I am new to Struts so I may be wrong but I think you have to put the attributes in the session scope because if you put it in the request scope it will only avalable to the jsp and not the next action that is called.