You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by an...@claire.co.jp on 2001/11/27 09:57:39 UTC

How can I set a beans scope from java code

Hi

How can I set the scope of a bean in java code.  I know how to do it in 
a jsp file, but not how to do it in jave code.

Regards

Antony


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How can I set a beans scope from java code

Posted by Viet Kevin <vi...@activia.net>.
If you want to set him in the request do this: 
	HttpServletRequetst request;
	request.setAttribute("myBean", bean);

Request object taken from the request made to you webserver


In the session :

	HttpSession session = request.getSession();
	session.setAttribute("myBean", bean);


In the application
	ServletContext context
	context.setAttribute("myBean", bean);
	



On Tue, 27 Nov 2001 17:57:39 +0900
antony@claire.co.jp wrote:

> Hi
> 
> How can I set the scope of a bean in java code.  I know how to do it in 
> a jsp file, but not how to do it in jave code.
> 
> Regards
> 
> Antony
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


=============================================================
-- KeV -- 
=============================================================



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>