This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Servlets and the fly likes How can i get session data into business objects. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How can i get session data into business objects." Watch "How can i get session data into business objects." New topic
Author

How can i get session data into business objects.

Rakesh Maddala
Greenhorn

Joined: Aug 05, 2010
Posts: 10
Hi all,

I have many number of flows in my web application. All the flows uses one generic method for getting data from the db. In this generic method, i want to check one condition from the session data. How can i do this? If i pass request object from action class till that 'generic method' it becomes too tedious. Do we have any other alternative solution for this problem?

Thanks for your precious time and help.


Warm Regards
Rakesh Maddala
Malatesh Karabisti
Ranch Hand

Joined: Jul 28, 2010
Posts: 153

I am not very clear what you want to achieve, as far as my understanding I can say. Your generic method might be taking the arguments pass the your values as the parameter to the generic method instead passing the big request object. or you can put all the values in ArrayList object and then pass the object.

hope that helps.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12675
    
    5
Do you mean request parameters or session data?

If you need request parameters, use the javax.servlet.ServletRequest.getParameterMap() method to get a Map - avoid passing the request reference around.

Bill



Java Resources at www.wbrogden.com
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Rakesh Maddala wrote:i want to check one condition from the session data
Why don't you just pass this value?

Let's supose that you need to know the userId in the session to create a city:


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
 
Don't get me started about those stupid light bulbs.
 
subject: How can i get session data into business objects.
 
Similar Threads
Logic needed for Survey tool
SessionBindingListener
Detailed functioning of Josso
Advantages and disadvantages of multiple DB calls
Session beans and Dao