session object is automatically shared between servlets and JSP pages when servlets
do .include or .forward on a requestDispatcher.  You manipulate objects in session
using putValue and getValue in servlets but in JSP it works somewhat different.

If an object is put into session in servlet:
Blah blah = new Blah("blah blah blah");
session.putValue("blah", blah);

then in JSP you say:
<jsp:useBean id="blah" class="com.blah.Blah" scope="session"/>

and you have now access to blah object so you can do this:

<%= blah.getName() %>

If you do not put the Blah object in the session and access the JSP page then the
Blah object will be constructed automatically.  NOTE: You must provide a
no-argument constructor for Blah for this to work (it's a requirement for a bean)!

d.

vaidyanathan_g wrote:

> Hi,
>
> In our application we are using session objects. We have to share the
> session objects between servlets and jsp.
>
> for this we are using setting the values in the session objects after the
> processing the servlet. Then we use setAttribute in the servlet to pass the
> object  and we use getAttribute in the jsp to get the object. This object
> has methods and this methods are utilized to get the value and to print them
> in JSP.
>
> Will this have an effect on the performance?
>
> What is the difference in performance if the object is used as a session
> object in JSP also with useBean tag ?
>
> We are using webLogic 4.5.1 as app server and NES 3.6 as Web server.
>
> Thanks
>
> Regards,
>
> Vaidyanathan G
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> 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

--
David Mossakowski              [EMAIL PROTECTED]
Programmer                           212.310.7275
Instinet Corporation

"I don't sit idly by, I'm planning a big surprise"

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
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