Because some of the BI Beans thin beans handle many of the same events that
they render, you should store the instance of the thin bean in the HttpSession
object, so that the thin bean exists throughout the session. Otherwise, you
would have to create a new instance of the thin bean and restore its state before
you route the event to the thin bean.
Thin beans that are registered with the ServletRequestHandler
are stored in the browser session. After you register a thin bean with the ServletRequestHandler
,
you do not need to do anything else to store the thin bean in the session.
The BI Servlet application that you create by running the BI Servlet Generation
wizard automatically stores thin beans in the session, through the Application
implementation.
In a JSP or UIX application, the thin beans are stored in the browser session whenever the scope attribute is set to session.
You can store a thin bean directly in the session, by calling HttpSession.putValue
or HttpSession.setAttribute
. You specify a name for the ThinBeanUI
implementation that you want to store, and you specify the ThinBeanUI
itself. The following example shows how you might store a thin crosstab in the
HttpSession
.
//assumes an HttpSession that is named httpSession ThinCrosstab crosstab = new ThinCrosstab(); crosstab.setThinBeanName("MyCrosstab"); httpSession.putValue("SessionCrosstab", crosstab); //or //httpSession.setAttribute("SessionCrosstab", crosstab);
To use the stored crosstab to handle future requests, you call HttpSession.getValue
or HttpSession.getAttribute
, passing the name that you used when you stored the thin bean.
The following code shows how to retrieve a crosstab from the session.
// assumes an HttpSession that is named httpSession ThinCrosstab crosstab = httpSession.getValue("SessionCrosstab"); //or //ThinCrosstab crosstab = (ThinCrosstab)httpSession.getAttribute("SessionCrosstab");
Some beans should always be stored in a session. Others should be stored only under certain circumstances. Still others do not ever need to be stored in a session.
In general, you should store thin presentation beans in a session whenever the thin beans display live data. You do not need to store thin presentation beans in the session whenever they display static data.
If you use graph pooling, then store the query that describes the data that the graph displays, but do not store the graph in the session.
Always store the following beans in the session:
Explorer tree
Explorer detail
Explorer search
Save As dialog
Find Member dialog
View Toolbar
View Type Tool
Rotate Tool
Sort Tool
Favorite Tool
Export Options dialog
Print Options dialog
Printer-Friendly View
Save Confirmation dialog
PrintOptions
instance has been rendered, you can destroy the instance. The Print
button in the rendered HTML sends an event to the PrinterFriendlyView
,
and the Cancel button sends a cancel event to the
servlet.