Problem with get/setAttribute

S

Steve Peake

I'm having a problem with get/setAttribute, I'm just doing:

a.jsp
String s_params = request.getParameter("PP");
session.setAttribute("PARAM_IN", s_params);

b.jsp
String passed_param= (String) session.getAttribute("PARAM_IN");

This always returns null in b.jsp. Chnaging the getParam line to :

String s_params = "anything";

works fine, so I'm guessing I'm not creating a new string correctly, but I
cannot find the correct method to do this. Any clues here?

Cheers

Steve
 
A

Andrew Thompson

I'm having a problem with get/setAttribute, I'm just doing:

a.jsp
String s_params = request.getParameter("PP");

try this..
if (s_params!=null) System.out.println(s_params);
else System.out.println("Parameter is 'null'!");

HTH
 
S

Steve Peake

try this..
if (s_params!=null) System.out.println(s_params);
else System.out.println("Parameter is 'null'!");

HTH

I know s-params is not null as keeping the getattribute in the same file
always works. It seems to be that I'm just passing the pointet to the
object, not the value itself, and I don't know how to get round that

Steve
 
A

Arvind

may be silly, but make sure you are indeed accessing the same session !

request.getSession(false);

Arvind
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top