Thanks a lot kevin



Kevin Duffey <[EMAIL PROTECTED]>@java.sun.com> on 01/20/2001
02:32:30 PM

Please respond to A mailing list about Java Server Pages specification
      and reference <[EMAIL PROTECTED]>

Sent by:  A mailing list about Java Server Pages specification and
      reference <[EMAIL PROTECTED]>


To:   [EMAIL PROTECTED]
cc:
Subject:  Re: how to access the contents of a session object from
      another s ession object directly


Here ya go:

public class bean1
{
}


public class bean2
{
  private HttpSession session = null;

  public bean2()
  {
  }

  public init(HttpSession session)
  {
    this.session = session;
  }

  public String getBean1SessionName()
  {
    Bean1 b1 = (Bean1) session.getAttribute("Bean1Name");
    if( b1 != null )
      return b1.getSomeStringValue();
    else
      return "";
  }
}


<%
  b2.init(session);
%>


  <%= b2.getBean2SessionName() %>

> -----Original Message-----
> From: A mailing list about Java Server Pages specification and
reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of John Thomas
> Sent: Saturday, January 20, 2001 12:31 AM
> To: [EMAIL PROTECTED]
> Subject: Re: how to access the contents of a session object from
another
> s ession object directly
>
>
> Hi,
>      Can u please show a sample code which would retrieve the b1
> session object, in bean b2 once session has been passed as a
parameter
> to an instance variable in b2. Do i have to use the
> session.getAttribute method to retrieve the object or is htere a
> better method.
>
> hanks for the help
> Regards
> John


===========================================================================

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

===========================================================================
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