| | |
Getting session
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2007
Posts: 59
Reputation:
Solved Threads: 3
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.
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.
You don't need `session' to display the request parameters; just use
BTW, you can get a reference to the `session' using the
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. I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
![]() |
Similar Threads
- Session end (PHP)
- Session variable (ASP.NET)
- session variable:again (ASP.NET)
- how can i used session and cookies ??? (PHP)
- How to maintain session for Web Services Object? (VB.NET)
Other Threads in the Java Forum
- Previous Thread: need help
- Next Thread: How to implement while and loop
Views: 847 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for Java
911 addressbook android api append apple applet application arguments array arrays automation binary bluetooth character chat class classes client code component csv database draw eclipse error event exception file fractal ftp game givemetehcodez graphics gui helpwithhomework html ide image input integer j2me japplet java javaarraylist javaprojects jmf jni jpanel julia linked linux list loop map method methods mobile netbeans newbie number object objects oracle oriented panel print printf problem program programming project projects recursion replaydirector reporting researchinmotion return robot rotatetext scanner screen se server set size sms socket sort sql stream string swing test threads time transfer tree ubuntu windows






