Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can we sent request after session timeout ?  RSS feed

James Long
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question is:
I have a DoSomethingServlet to created a MyBean object and put it into session object, then DoSomethingServlet foward request to showMyBean.jsp page the show the result.
At the beginning of showMyBean.jsp I coded the following:
<jsp:useBean id="myBean" class="package.MyBean"
<%if(session.getAttribute("myBean") != null){
myBean = (MyBean)session.getAttribute("myBean");
if(myBean == null){
System.out.println("The sessin object is null now")
<jsp:forward page="/MyApp/servlet/DoSomethingServlet" />
I check the session myBean if there is one,
then I get the MyBean object from the session.
Then check if the MyBean object is null
then I foward request to the DoSomethingServlet to
do something and create MyBean object and put into session
object again.
The problem occurs when I have not touched the showBean.jsp page in the browser for certain minutes (30? 20? minutes), the session may be time out, and I click a link in the jsp page for
this showMyBean.jsp page.
The result is a blank page show in the broswer instead of the new showMyBean.jsp page and I check console which show "The sessin object is null now" message.
My question is why
<jsp:forward page="/MyApp/servlet/DoSomethingServlet" />
doesn't work for me at this situation???
How can I get the new showMyBean.jsp page,
i.e. how can I invoke DoSomethingServlet again?
Anything wrong???
If any one, can tell me how to solve this problem. It would be very appriciated!
Thank you in advance!
J. Long
William Brogden
Author and all-around good cowpoke
Posts: 13078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The default timeout for HttpSession objects in Tomcat and JRun is 30 minutes - this may be a pretty widespread convention.
I think you need to establish an error page for your jsp so you can get more information than just a blank screen.

author of:
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!