julian sitkewich wrote:
>
> I pose a question, in the MVC (Model-View-Controller) architecture
> information is commonly passed between servlet and JSP via session. This
> seems to go against certain principles of server overhead and memory
> consumption. My example is this: A servlet creates a HUGE Vector object of a
> company department directory list. The request is forwarded to the JSP to
> list the contents of the Vector. Is there a better way than to store my
> large Vector in the user Session??

If the Vector (or any object created by the servlet) is only going
to be used by the JSP page you forward to, use a request attribute
to pass it to the JSP page. In the JSP page, it's then available as
a request scope object. If you use a <jsp:useBean> action to get it
in the page, you can then use custom actions and/or scripting code
to access the bean. Note! Even though <jsp:useBean> contains "bean"
in its name, it can be used to associate any object that already
exist in one of the standard scopes with a name used in the page,
in scripting code or in action element attributes.

You should only place objects in the session scope or application
scopes if they need to survive the processing of the current request.

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to