954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Getting session

Hello,

How can I get a reference to a session? I have a page, which forms a query string, and in another page I would like to display the attributes of it. I don't want to introduce scriplets, so I am trying to do this in a pure Java file, where request is not an implicit-object. When I was using Struts, I was able to get that reference by HttpSession session = ServletActionContext.getRequest().getSession(); Can I do something similar without Struts? I tried to google it, but nothing helpful.

Thanks in advance.

Chaster
Junior Poster in Training
68 posts since Jun 2007
Reputation Points: 12
Solved Threads: 3
 

You don't need `session' to display the request parameters; just use request.getParameter("parameterName") inside your servlets' doGet / doPost and you should be good to go.

BTW, you can get a reference to the `session' using the HttpServletRequest ; read the API docs.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You