tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian.Men...@GIquadrat.de
Subject Re: Use a jsp:useBean Bean from a servlet?
Date Wed, 19 Jul 2000 13:54:24 GMT

Hi Matt,

thank you, but thats what I meant with "setAttribute/getAttribute",
setValue/getValue is deprecated in servlet api 2.2.

When I put the bean in the session I have it twice
(in the jsp pagecontext and in the session).

I was looking for a way to use the bean I created
via <jsp:useBean id="id" class="Class" scope="session" />
in a servlet in the same session

Regards
Christian Menzel



                                                                                         
 
                    Matt Goss                                                            
 
                    <mgoss@rtci.c        To:     tomcat-user@jakarta.apache.org       
    
                    om>                  cc:                                          
    
                                         Subject:     Re: Use a jsp:useBean Bean from a  
 
                    19.07.00             servlet?                                        
 
                    15:22                                                                
 
                    Please                                                               
 
                    respond to                                                           
 
                    tomcat-user                                                          
 
                                                                                         
 
                                                                                         
 



Christian,
In order to use a bean with session scope you will need to add it to the
session object.
ie:
to add:
HttpSession ses = request.getSession(true);
mybean mb = new mybean();
ses.putValue("mybean1", mb);

to get:
HttpSession ses = request.getSession(true);
mybean mb = (mybean) ses.getValue("mybean1");

hope this helps,
Matt Goss

Christian.Menzel@GIquadrat.de wrote:

> Hi,
>
> is it possible to access a via jsp:useBean generated bean with session
> scope in a servlet?
> In jsp servlets one can use the pageContext class.
> Is there any other way than to use the setAttribute/getAttribute?
>
> Thanks
> Christian Menzel
>
(See attached file: mgoss.vcf)


Mime
View raw message