How could I detect the bean is in session scope? What I am trying to do is this: In a jsp page, if the bean is in session scope, I will call beans method and get its values. If the bean is not in scope, I will direct the page to a servlet, which will instantiate a new bean and place it into the session.
Created May 4, 2012
Govind Seshadri You will need to have a simple scriptlet within your page
to take care of this:
<% MyBean beany = (MyBean) session.getValue("beanId"); if (beany != null) { %> <jsp:getProperty name="beany" property="someProperty"/> <jsp:getProperty name="beany" property="anotherProperty"/> <% } else { %> <jsp:forward page="/servlet/myServlet"/> <% } %>