Up vote 1 down vote favorite share g+ share fb share tw.
I have a jsp page which has different IF conditions. On load of the jsp page,one of the if condition will be invoked based on value set to fuse action. I have a problem like, first time when the page is loaded then IF condition1(say, for ex) is invoked and a variable is assigned to the HTTPCOntext session object.
Second time when the page is loaded(meaning after form submission), another IF condition2(Say for ex) is invoked. I tried accessing the session object in this if condition, the value in the session object is null. Is it something like session variable in one scriptlet is not accessible by other scriptlets in the same jsp?
I need to access the session object in second IF condition, please let me know the way to acheive this. Thanks in Advance Rupa jsp session link|improve this question edited Sep 23 '10 at 12:12 asked Sep 23 '10 at 11:56ASD1931112 40% accept rate.
HTTPContext is in ASP not JSP, or are you referring to javax.xml.ws.spi.http. HttpContext used in web services? – JoseK Sep 23 '10 at 12:09 I am usign Jsp.
I am not using any import statments(to indicate it as ServeletContext) and directly using the below statement: session. PutValue("Test",testStringVariable); – ASD Sep 23 '10 at 12:25.
Several facts: Sessions are backed by cookies. Cookies are by default bound to a specific domain and context path. When cookies are disabled in the client side, you have to take care over URL rewriting to include the session ID as jsessionid.
Writing raw Java code in a JSP file is a bad idea. So if you've stored an object in the session and it is not available in the next request, then it can have the following causes: The other JSP page is in a different domain or context. The client has cookies disabled and you didn't take care about URL rewriting.
You are storing and accessing it the wrong way. Since you're talking about something like "HTTPCOntext" which makes no sense in terms of JSP/Servlet and are using a single JSP page, I think it's the last one of the possible causes. Here's a kickoff example of how to store an attribute in the session the proper way: Object someObject = "This is just a String.
"; request.getSession(). SetAttribute("someName", someObject); and here how to obtain it: Object someObject = request.getSession(). GetAttribute("someName").
Session. PutValue is deprecated Use session. SetAttribute(String name, Object value) like this session.
SetAttribute("Test",testStringVariable) and fetch it by session. GetAttribute("Test"). This should work.
Have you confirmed that session. GetAttribute("Test") is itself giving null, or have you initialized some variable to null and printing out that one instead.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.