permaculture playing cards*
The moose likes Servlets and the fly likes session/application variable set in JSP, lookup in Servlet. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "session/application variable set in JSP, lookup in Servlet." Watch "session/application variable set in JSP, lookup in Servlet." New topic
Author

session/application variable set in JSP, lookup in Servlet.

sean cee
Ranch Hand

Joined: Oct 24, 2000
Posts: 115
Hi all,
I have set a session, application var. in a JSP as follows:
<%
..
session.setAttribute("debugmode",String.valueOf(debugmode));
getServletContext().setAttribute("log",log);
..
%>
then this JSP will call a Servlet and from that Servlet I am try to use those session, application var. as follows:

HttpSession session = request.getSession(false);
Boolean tmpb = new Boolean((String)session.getAttribute("debugmode"));
BufferedWriter log = (BufferedWriter)getServletContext().getAttribute("log")

Which is nothing complicated but both values are null when I try to retriev them from the Servlet.
Can someone shed some light on this?
Thanks


Sean <br />SCJP2, SCJP2p1.4, SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: session/application variable set in JSP, lookup in Servlet.
 
Similar Threads
why Internet Explorer is different than other browsers in jsp?
Session Data Crossover Problem... Please help... Thanks!
Session Data Crossover Problem
how to call Jsp in servlet
Session var set in JSP