i write in
a.jsp page

String s1="amrita";
session.setAttribute("ana",s1);

after some statements

i write out.print=(String)session.getAttribute("ana") //it prints the value in page b. jsp out.print=(String)session.getAttribute("ana") //it prints null

How exactly did you write this:

out.print=(String)session.getAttribute("ana") //it prints null

In your code?

You can try this. I am new in JSP but i m making project in jsp, which use sessions. so its working. try this.
in a.jsp

HttpSession s  =request.getSession(true);
String s1 = "Amrita";
s.setAttribute("ana",s1);

in b.jsp

HttpSession s  =request.getSession();
String ot = (String)s.getAttribute("ana");
out.Println(ot);

try ths n reply me.

hey, if it is working thn mark it solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.