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

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

Hi all, I want to encrypt the text data before inserting it into the database.And to decrypt it after reading it from the database to get the original data. I want to use asymmetric encryption for this, so that exposure of the encryption key (or logic, whatever) wouldn't harm anything. Is it possible? Anybody has dealt with some problem like this? Or any sample code? Thanks! 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    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: Access the values stored in a previous session bean.

Posted By:   ankush_purwar  
Posted On:   Tuesday, February 22, 2005 12:07 AM

I have seen your both JSP pages,
In boh JSP pages you have created an EJBObject of stateful session bean.It means in both JSP pages refer to different EJBObjects,
That's why you are not getting proper result.
In your case you have to create only one object and reuse it,then you will be getting proper results.
About | Sitemap | Contact