For Programmers: Free Programming Magazines  


Home > Archive > Java Beans > October 2006 > java Bean scope session









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author java Bean scope session
rs232

2006-10-12, 7:04 pm

Hi,
I have the following problem:

I have created a java Bean, and I use it without problems.
Now I'd want using the same instance above more jsp pages, so I declare
it as:
<jsp:useBean id="myb" scope="session" class="myJavaBean"/>

But in anothers jsp pages (in the same session) where I post any data,
I don't call
<%
myb.mymethod();
%>

I receive : cannot resolve symbol myb..
why this? I set the scope to session!!!

I'm working under tomcat 5.0.28.
I already checked if session is enabled on my web server, with
session.setAttribute() and session.getAttribute()
all is ok!

thanks
teo

rs232

2006-10-12, 7:04 pm

I solved!
I used command: <jsp:useBean id="myb" scope="session"
class="myJavaBean"/>
in every jsp pages. In this way if there is a bean in session, the bean
is not created, but used the existing!
Anyway there is another problem: I set property bean in my first jsp
page, but
the value is lost in the others pages! Why this?

thanks
teo

rs232 ha scritto:

> Hi,
> I have the following problem:
>
> I have created a java Bean, and I use it without problems.
> Now I'd want using the same instance above more jsp pages, so I declare
> it as:
> <jsp:useBean id="myb" scope="session" class="myJavaBean"/>
>
> But in anothers jsp pages (in the same session) where I post any data,
> I don't call
> <%
> myb.mymethod();
> %>
>
> I receive : cannot resolve symbol myb..
> why this? I set the scope to session!!!
>
> I'm working under tomcat 5.0.28.
> I already checked if session is enabled on my web server, with
> session.setAttribute() and session.getAttribute()
> all is ok!
>
> thanks
> teo


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com