Rimzim Basu wrote:
I get this exception "javax.servlet.ServletException: BeanUtils.populate" error when I leave the page open for a while (around 30 mins) and then click on the 'Submit' button on my page.
Joe Ess wrote:
Rimzim Basu wrote:
I get this exception "javax.servlet.ServletException: BeanUtils.populate" error when I leave the page open for a while (around 30 mins) and then click on the 'Submit' button on my page.
Does it work if you click "submit" promptly? If so, it sounds like your session is timing out and Struts is relying on some session information to rebuild the list. You can control the session timeout by adding a session-timeout declaration to your application's web.xml:
Rimzim Basu wrote:[ But, will this not cause the sessions to keep piling up?
Rimzim Basu wrote:the users that we mostly deal with seem to leave the page open and come back later to resume what they were doing.
Rimzim Basu wrote:
Is there a way I can handle this without this error showing up? It's pretty old code so any design change would be big. So looking for other options as well.
Joe Ess wrote:
Rimzim Basu wrote:[ But, will this not cause the sessions to keep piling up?
Yes. You will have to watch your server and make sure you have enough resources to handle them. Depending on your server, the session may be stored in memory, on disk, in a DB, or some other option.
Rimzim Basu wrote:the users that we mostly deal with seem to leave the page open and come back later to resume what they were doing.
You should have some sort of timeout implemented see here. You need to balance the needs of your users against the resources available to your server.
Rimzim Basu wrote:
Is there a way I can handle this without this error showing up? It's pretty old code so any design change would be big. So looking for other options as well.
This appears to be a known issue with Struts 1. I assume that's what you are using. Struts 1 has other problems too: see here.
Rimzim Basu wrote:
I believe I can use something like this in the action class:
HttpSession session = request.getSession(false);
if (session != null) session.invalidate();
return mapping.findForward("success");
But, where am I to include this?
Rimzim Basu wrote:
I mean, should this be implementing this if I keep session timeout as -1?
That depends on what you are trying to accomplish. As I said previously, the "best practice" is to have an automatic session timeout. How is security implemented? I would assume that anyone who's session has expired should be forwarded to the login page rather than allowed to continue into an action.
Rimzim Basu wrote:I'm fairly new to development so I'm still learning so my questions would seem quite silly
Rimzim Basu wrote: I was thinking if I out -1 as the session timeout, I'll have to invalidate the sessions manually.
Rimzim Basu wrote:
Also, I tried checking if the session is null just after I enter the submit method in Action class so that I can redirect it to the home page but somehow it doesn't enter this method at all when I click on 'Submit' and the error comes