How to Access the values stored in a previous session
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   nirjaru_niru
Posted On:   Monday, February 21, 2005 10:53 PM

I am using a stateful session bean as a controller instead of servlets. My stateful session bean is having two methods setName(),getName(). From the client side using the first jsp page I am setting my name by setName() method, submit the request to the controller and my stateful session bean displays the second jsp page. In the second jsp page, I am getting my name By calling the getName() method of the stateful session bean . How to Access the values stored in a previous session. I have tried the way given below using jboss server.For one user its returning the name in the second page set in the first jsp page. But for more than two users the values are mixed up.ie, It can't   More>>

I am using a stateful session bean as a controller instead of servlets.



My stateful session bean is having two methods setName(),getName().

From the client side using the first jsp page I am setting my name by setName() method, submit the request to the controller and my stateful session bean displays the second jsp page.

In the second jsp page, I am getting my name By calling the getName() method of the stateful session bean .

How to Access the values stored in a previous session.

I have tried the way given below using jboss server.For one user its returning the name in the second page set in the first jsp page.

But for more than two users the values are mixed up.ie, It can't maintain the state.


First jsp page


Context ctx = new InitialContext(env);
Object obj = ctx.lookup("HelloWorld");
HelloHome home = (HelloHome)javax.rmi.PortableRemoteObject.narrow( obj, HelloHome.class );
Hello helloWorld = home.create();
helloWorld.setName(request.getRemoteAddr());

Second jsp page


Context ctx = new InitialContext(env);
Object obj = ctx.lookup("HelloWorld");
HelloHome home = (HelloHome)javax.rmi.PortableRemoteObject.narrow( obj, HelloHome.class );
Hello helloWorld = home.create();
System.out.println( helloWorld.getName());


Please help me out to find a solution for this problem.

   <<Less

Re: How to Access the values stored in a previous session

Posted By:   Anonymous  
Posted On:   Monday, February 28, 2005 04:16 AM

If you could provide the source code for the two JSP's and the session bean, it would be easier to see what the flaw may be.
About | Sitemap | Contact