Hi all, i am working on tomcat webserver, i am created new session in servelt using HttpSessions and putting some values in the session and when i try to access these session value in JSP page it is giving the value as null i don't know why. my servlet code is like... . . HttpSession session = req.getSession(true); String dsn= getInitParameter(); session.putValue("dsn",dsn); . . when i try to access the session in my JSP page as . . String sesvalue = (String)session.getValue("dsn"); out.println(" session value "+sesvalue); . . it is displays the null value can any one help as how to solve this problem. thank in advance
Dmitriy Pavlyuk
Ranch Hand
Joined: Mar 25, 2001
Posts: 33
posted
0
Hi Try to send jsessionid with request as follow <a href="main.jsp;jsessionid=<%=session.getId()%>">Page</a>
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
1
posted
0
Your servlet and the JSP have to be in the same web application if they are to share the same session. Perhaps that is the cause of the problem. Bill
Dil se....,<BR>Dayanand<BR>0065-8839071(off)<BR>0065-7547034(Res0
Raghavendra Holla
Ranch Hand
Joined: Jun 02, 2000
Posts: 58
posted
0
getValue and putValue are deprecated !. They will return null value from Version 2.2. So as Dayanad indicates use getAttribute and setAttribute. For further clarification refer Servlet API documentation. regards holla.
Hi Dayanand i am using jdk1.2.2 so when i try to use the method session.setAttribute("string",object); it is not compiling and giving the error setAttributes(java.lang.String, java.lang.Object) not found in interface javax.servelt.http.HttpServlet. so do u want me to change jdk version? and also can u please tell me how to set initial parameters for web.xml file on tomcat webserver. thankq vishnu