You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Huaxin <hx...@cs.ualberta.ca> on 2001/09/29 23:10:57 UTC

servlet to jsp

how can i create a bean in a servlet, and then the serlet
forward/include to a jsp, the jsp can read from the bean?

thanks a lot


Re: servlet to jsp

Posted by Will Stranathan <wi...@thestranathans.com>.
In the servlet....

request.setAttribute("mybean", theBeanInstance);
// Then forward

In the JSP:
<jsp:useBean id="mybean" class="MyBean" scope="request" />
<%= mybean.getWhatever() %>

Will Stranathan

Huaxin wrote:

> how can i create a bean in a servlet, and then the serlet
> forward/include to a jsp, the jsp can read from the bean?
> 
> thanks a lot
> 
> 



Re: UNSUSCRIBE

Posted by Manu KY <ma...@yahoo.com>.
Hi,
Create the bean in servlet , set the bean object as an attribute to the 
request , session or servletContext object and access the bean instance 
with appropriate corresponding scope from the Jsp.

Manu
>UNSUSCRIBE
>----- Original Message -----
>From: "Huaxin" <hx...@cs.ualberta.ca>
>To: <to...@jakarta.apache.org>
>Sent: Saturday, September 29, 2001 11:10 PM
>Subject: servlet to jsp
>
>
> > how can i create a bean in a servlet, and then the serlet
> > forward/include to a jsp, the jsp can read from the bean?
> >
> > thanks a lot
> >
> >


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


UNSUSCRIBE

Posted by Gaƫtan Lepargneul <ga...@hotmail.com>.
UNSUSCRIBE
----- Original Message ----- 
From: "Huaxin" <hx...@cs.ualberta.ca>
To: <to...@jakarta.apache.org>
Sent: Saturday, September 29, 2001 11:10 PM
Subject: servlet to jsp


> how can i create a bean in a servlet, and then the serlet
> forward/include to a jsp, the jsp can read from the bean?
> 
> thanks a lot
> 
>