webguy08
04-06-2010, 02:13 AM
Hi all,
I am writing up a JSPX document; using <jsp:.../>, <c:.../>, and EL expressions (${...}). I have saved an attribute to a servlet, like so:
HttpSession session = request.getSession();
session.setAttribute("username", username);
Where the username is taken from the request parameters. I want to access this information in my JSPX document, and was wondering if it were possible to access attributes stored in that servlet's session.
Here is the relevant part of my JSPX page:
<jsp:useBean class="package.Servlet" id="servlet" scope="session"/>
<c:out value="${HERE IS WHERE I WOULD LIKE TO GET THE USERNAME DATA FROM THE SERVLET}"/>
I know it would be possible to save the username as a class variable in the servlet and access it here, but I was wondering if anyone knew how to get it directly from the servlet's session, or if there is any other method of getting it.
Any help is appreciated! :thumbsup:
I am writing up a JSPX document; using <jsp:.../>, <c:.../>, and EL expressions (${...}). I have saved an attribute to a servlet, like so:
HttpSession session = request.getSession();
session.setAttribute("username", username);
Where the username is taken from the request parameters. I want to access this information in my JSPX document, and was wondering if it were possible to access attributes stored in that servlet's session.
Here is the relevant part of my JSPX page:
<jsp:useBean class="package.Servlet" id="servlet" scope="session"/>
<c:out value="${HERE IS WHERE I WOULD LIKE TO GET THE USERNAME DATA FROM THE SERVLET}"/>
I know it would be possible to save the username as a class variable in the servlet and access it here, but I was wondering if anyone knew how to get it directly from the servlet's session, or if there is any other method of getting it.
Any help is appreciated! :thumbsup: