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:
Seems like a silly thing to ask, but both 'debugmode' and 'log' are variables that are in scope when you place them into the session and application contexts in your JSP?
sean cee
Ranch Hand
Joined: Oct 24, 2000
Posts: 115
posted
0
yes. and within that JSP I can look up those attributes as well.
Ganga Ch
Greenhorn
Joined: Nov 15, 2001
Posts: 1
posted
0
HttpSession session = request.getSession(false); Boolean tmpb = new Boolean((String)session.getAttribute("debugmode")); BufferedWriter log = (BufferedWriter)getServletContext().getAttribute("log") Hi, you might have found the solution, but dont you have to set the session to "true" when you "getSession". -G
Kyle Brown
author
Ranch Hand
Joined: Aug 10, 2001
Posts: 3879
posted
0
Maybe -- maybe not. The difference between getSession(true) and getSession(false) is that getSession(false) will return null instead of an HttpSession object if a session has not yet been established (with getSession(true)) for that user... Kyle ------------------ Kyle Brown, Author of Enterprise Java (tm) Programming with IBM Websphere See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.