tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David M. Holmes" <>
Subject Re: How can I have two beans in the same JSP?
Date Wed, 23 Aug 2000 16:00:18 GMT
If you create the bean on page1.jsp with a "request" scope then that bean will available to
other pages during the request.

<jsp:useBean id="myBean" class="mypackage.myclass" scope="request"/>
<jsp:setProperty name="myBean" property="*"/>
<jsp:forward page="page2.jsp" flush="true"/>

<jsp:useBean id="myBean" class="mypackage.myclass" scope="request"/>
now myBean is available just as it was in page1.jsp with any properties that were set (same


--- Rui Oliveira <> wrote:
> Hello,
> I have 2 JSPS and I want to get a variable from one to the other. 
> Lets say that I have a page called "page1.jsp" and that I have a
> "bean_A" in this page. One of the methods from that bean returns a value
> that I must use in the next JSP, lets call it "page2.jsp". 
> My question is: do I need to open the first bean (bean_A) in the second
> page (page2.jsp), in order to get the value from that bean? If so, how
> can I keep the state of that bean, so that it wont lose its value from
> page1.jsp to page2.jsp?
> Thx
> Rui

Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!

View raw message