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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.