wood burning stoves 2.0*
The moose likes Java in General and the fly likes how to getSession in simple java class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to getSession in simple java class?" Watch "how to getSession in simple java class?" New topic
Author

how to getSession in simple java class?

Rd Dari
Ranch Hand

Joined: Feb 22, 2010
Posts: 202

Hi all,

i have a code in jsp in which i am setting a value in session and wanna get it in a simple java class...


I used this but its not showing

request object...

please give me another solution...

Thanks
Aditya Jha
Ranch Hand

Joined: Aug 25, 2003
Posts: 227

Usually, it is not this easy to get a hold of web-container objects (like request, response, session etc.) in POJOs. Still, it would help if you could provide more details like:

1. Which MVC framework are you using, if any?
2. What is the flow of request? How is the POJO (simple Java class) gets invoked?
3. Does the information that you're trying to pass from JSP to POJO have to be in Session scope, or can it be in Request scope too?

Cheers!
Rd Dari
Ranch Hand

Joined: Feb 22, 2010
Posts: 202

Hi Aditya,

I want to send a mail to a vendor(vendors) using a button request (ORDER) when I click this button a window will open in which a checkbox,vendor name input type,services and email_address fetching from the database and I check a checkbox or all button for all checkbox list and its submit button will send the request on a servlet in which i am fecthing all the fields from the request.getParameter in this servlet i am using a simple java class.... like this and want to set value in this mail table which will show in the mail i send header of the table but in the table i want to send value according to runtime user....











this is all the pages..............
Aditya Jha
Ranch Hand

Joined: Aug 25, 2003
Posts: 227

May be I'm missing something here... why can't you pass userid as a parameter to the method in the simple class (mail.MailToVendor() I suppose), just like you're passing vendor name, email address etc.?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to getSession in simple java class?
 
Similar Threads
Getting error while compiling Java File
Using Serialize to hold login info
returning multiple values in a web service
Implementing HttpSession in the Spring MVC
How to Implement POST Method in RESTFul web services using Jersey