i am facing an strange problem.There are one java application with struts.
it is working fine.
there was one modification in this application that we need to change this application to read user id by cookies.
So in login action class i read the cookie and set to formbean property.
but when next time in any action it is going to read data from it is comming null.
i simply do
1-read cookie value which is userid suppose it is coming 00116084
now i set this value to userid frombean propert by form.setUserId(00116084)
user call login method
i simply read userid from bean and call db method. and set value in session as it was
till here every thing is fine.
now when i read userid from session in any other class it gives error null in seesion.
so it is happning .the proble only when i read user id from cookie and set it to formbean.
please help this is urgent
There is no need to set the userid to the fombean object and then store it in the session. you can directly store it in the session.Like,
You can do as in above. In your scenario, check the form bean scope. i mean whether it is request (or) session scope. If it is request , what happens is for every request prior to populate() , reset() is called. which clears previous values.
Joined: Mar 16, 2012
thanks for reply
my first question if i set directly into the seesion as you tell then will problemget resolved means this was the problem.
or after thuis i need to check another thing as scope.
but why it reset when i comes by cookies
means when i access normaly then it is ok.
and please tellme how i resolve this problem
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com