• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to getSession in simple java class?

 
Rd Dari
Ranch Hand
Posts: 212
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 227
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 212
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 227
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic