|
| hi
Sorry if this seems like a JSP 101 question,...
i've got a set of jsp's and beans that make up a website. most jsp
pages communicate with one bean, with no problem at all. a menu jsp
uses a separate bean, and a report page uses a third. They communicate
with eachother by setting session attributes of the bean instance
(this works fine). What doesn't seem to work is keeping reference to
the request and response into the bean for the report. It seems to
lose it at random points.
tags in all pages
<jsp:useBean id="bean_n" scope="session" class="Bean_n">
<% Bean_n.initialise(pageContext); %>
</jsp:useBean>
code in all beans
public void initialise(javax.servlet.jsp.PageContext PC ) {
Object obj;
super.initialise(PC); // defines log & abend routines. gets
connection
pageContext = PC;
servletContext = pageContext.getServletContext();
session = pageContext.getSession();
servletResponse = (HttpServletResponse)
pageContext.getResponse();
servletRequest = (HttpServletRequest)
pageContext.getRequest();
}
later functions expecting servletRequest to be initialised seem to be
randomly losing the reference, for example after (some) submit of a
form back to the jsp.
Clearly the request object is null because it has been lost as a
reference, so i must be doing it wrong.
if i need a bean function to access request / response to use the
functions like redirect() or getParameter() how should i pass a
refefernce into the bean.
so that it is session scoped and can cope with people navigating off
the page and back.
Any ideas?
|
|