• Post Reply Bookmark Topic Watch Topic
  • New Topic

session value not get into another jsp page  RSS feed

 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i made a session in one jsp page,but it can't access in other jsp page
first.rs=first.st.executeQuery("select emp_fname,emp_lname from employee where user_name='"+t1+"'");
while(first.rs.next())
{
ss1=first.rs.getString(1)+" "+first.rs.getString(2);
h++;
}


session.setAttribute("name",ss1);


//this session value get in this page but not other
 
Prafulla N. Patil
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you check your jsp @ page directive that must be session = true

<%@ page
[ language="java" ]
[ extends="package.class" ]
[ import="{package.class | package.*}, ..." ]
[ session="true | false" ]
[ buffer="none | 8kb | sizekb" ]
[ autoFlush="true | false" ]
[ isThreadSafe="true | false" ]
[ info="text" ]
[ errorPage="relativeURL" ]
[ contentType="mimeType [ ;charset=characterSet ]" | "text/html ; charset=ISO-8859-1" ]
[ isErrorPage="true | false" ]
%>

This might be one of the reason
 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya i checked it

and i also did like this for check
HttpSession session=request.getSession(true);
session.setAttribute("aa",s1);

when i write in same page
session.getAttribute("aa");


it shows correct value in this page only not other page

this value is assigned in session, but not get in other page
 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please post the entire code?
 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also have a look on this Sample
 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to add value retrieve from database in session

code i already written in this forum
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!