Rimzim Basu

Greenhorn
+ Follow
since Nov 22, 2016
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rimzim Basu



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.



I'm sorry, Joe. I'm fairly new to development so I'm still learning so my questions would seem quite silly. I was thinking if I out -1 as the session timeout, I'll have to invalidate the sessions manually. 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
3 years ago

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.




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? Should it be after the submit? Again, I'm missing out on that part. I mean, should this be implementing this if I keep session timeout as -1?

Thanks,
Rimzim
3 years ago

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:




Hi Joe,

Thanks a lot for replying.

If I click on 'Submit' promptly, it works absolutely fine. Earlier the session timeout value was 30. I had changed it to -1 and it seems to be working fine even after an hour. But, will this not cause the sessions to keep piling up? I am not very clear on this. Also, the users that we mostly deal with seem to leave the page open and come back later to resume what they were doing. 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.

Thanks,
Rimzim
3 years ago
Hi Joe,

Thanks a lot for replying.

If I click on 'Submit' promptly, it works absolutely fine. Earlier the session timeout value was 30. I had changed it to -1 and it seems to be working fine even after an hour. But, will this not cause the sessions to keep piling up? I am not very clear on this. Also, the users that we mostly deal with seem to leave the page open and come back later to resume what they were doing. 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.

Thanks,
Rimzim
3 years ago
Hello,

This is my first post so I apologize for breaking any rules.

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. I have seen a couple of posts on Indexing here on CodeRanch and I went through them, trying to understand and implement, but nothing seems to be helping. Here is the error screenshot:




FORM (PhaseTrackerForm.java):




FORM (PhaseTrackerSelectApprInfo):





JSP Code:




struts-config.xml mapping:




I did understand indexing getter setter but 'selectApprList' is the id for <logic:iterate> and an array of type PhaseTrackerSelectApprInfo. I read that array type is supposed to work but I get the error anyway.

I'm really confused because I've been breaking my head over what I'm missing. Any help is appreciated.
3 years ago