Jump to content

Httpsession


softlab

Recommended Posts

Hi, I'm softlab on Johnny.

 

In my servlet I have these lines of code:

 

request.getSession().setAttribute("paginaUtente",paginaUtente);

RequestDispatcher dispatcher = contesto.getRequestDispatcher(paginaJSP);

dispatcher.forward(request,response);

 

and the attribute is set to "../sicurezza/accesso.jsp".

 

When the jsp page is served, there are these lines of code:

 

String paginaUtente = (String)session.getAttribute("paginaUtente");

paginaUtente = paginaUtente == null ? "" : paginaUtente.trim();

 

but now the attribute is empty.

 

Why the value set in the session by the servlet is not available for the JSP? Do not they use the same session?

 

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...