I tried what you suggested, but it still doesn't function right.
Below is test.jsp which sets up the initial session object:
<%@ page import="java.util.*"%>
<html>
<head>
<title>Test Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body leftmargin="4" topmargin="4">
<jsp:useBean id="sessionInfo" scope="session"
class="org.foo.session.SessionInfo"/>
<%
sessionInfo.setInfo("Info was set on the test.jsp page");
session.setAttribute("sessionInfo", session.getAttribute("sessionInfo"));
// This was added just to see if "sessionInfo" was stored in the session
object, and it was
Enumeration enum = session.getAttributeNames();
while(enum.hasMoreElements()) {
out.println(enum.nextElement().toString());
}
out.println("<p>" + sessionInfo.getInfo() + "</p>");
%>
</body>
</html>
Below is test2.jsp which should display the information stored in the
SessionInfo bean:
<html>
<head>
<title>Test Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body leftmargin="4" topmargin="4">
<jsp:useBean id="sessionInfo" scope="session"
class="org.foo.ntarget.session.SessionInfo"/>
<p><b>We are on test page 2</b></p>
<p><%out.println(sessionInfo.getInfo());%></p>
</body>
</html>
If I remove <distributable/> from web.xml, then test2.jsp will show "Info
was set on the test.jsp page" as expected. So something else still isn't
right.
Dustin
> -----Original Message-----
> From: Jules Gosnell [mailto:jules@;mortbay.com]
> Sent: Thursday, November 14, 2002 11:25 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [JBoss-user] Jetty <jsp:useBean> and Clustering ..
>
>
> Here is a reply I wrote to the same problem recently - the
> guy came back
> and told me it worked fine:
>
> Bernie,
>
> I haven't had time to run the app, but I think that I know what is
> happening.
>
>
> Imagine you are talking to a remote object (e.g. an EJB).
> you create a HashTable - ht
> you call bean.setHashTable(ht);
> you call ht.put("test", "123");
> you call bean.getHashTable();
>
> would you expect the returned HashTable to contain "test" -
> NO, because
> when talking to a remote/distributed object your semantics shift from
> REFERENCE to VALUE. Thus with a local session you can put in
> an object
> and maintain a reference to that object, however with my (current)
> distributable impl, you can only COPY an object into it.
>
> To update an object that is already in the session, you just
> put it in
> again. This tells Jetty to redistribute this attribute. Without this
> kick we have no idea when you may have changed an object and have no
> option other than to periodically redistribute the entire session -
> expensive.
>
> As soon as I find the time, I shall adapt my current impl to
> be a hybrid
> of the two strategies outlined above.
>
> Now to specifics.
>
> All you need to do is ensure that if you mess with anything
> kept in the
> session in your JSPs, you then call setAttibute() again with
> them. This
> will copy the new value into the session and force immediate
> distribution.
>
> I'm no JSP expert, but I believe that you can declare beans as being
> within session scope, then act upon them by name ?, In this case you
> will need to figure out where in the session Jasper is
> keeping the bean
> and call session.setAttribute(<bean-name?>,
> session.getAttribute(<bean-name>)); afterwards, or something similar.
>
> Done this way your code will still work in non-distributable
> mode, since
> we have not extended the spec.
>
> Hope this makes sense.
>
> Try it out and come back to me with any problems - I am off air until
> monday.
>
> Jules
>
> Barlow, Dustin wrote:
>
> >Has anyone gotten <jsp:useBean> style session's to propagate
> across clusters
> >in 3.x (3.2.0beta2 in my case)?
> >
> >For example:
> >
> ><jsp:useBean id="userInfo" scope="session"
> >class="org.foo.session.UserInfo"/>
> >
> >I have found that if I include the <distributable/> tag in
> my web.xml file,
> >that any session scoped classes no longer work between pages
> on the _same_
> >server instance. If I set a String member variable in the
> UserInfo object
> >on one jsp page and then try to reference it from a second
> jsp page, it is
> >always null. If I remove <distributable/> from web.xml,
> then the object's
> >member values do survive across multiple jsp calls. The
> UserInfo object is
> >also not being propagated to any of the cluster nodes
> either. (I am running
> >the "All" target with all default settings).
> >
> >Dustin Barlow
> >
> >
> >
> >
> >
> >-------------------------------------------------------
> >This sf.net email is sponsored by: To learn the basics of securing
> >your web site with SSL, click here to get a FREE TRIAL of a Thawte
> >Server Certificate: http://www.gothawte.com/rd524.html
> >_______________________________________________
> >JBoss-user mailing list
> >[EMAIL PROTECTED]
> >https://lists.sourceforge.net/lists/listinfo/jboss-user
> >
>
>
>
>
> ______________________________________________________________
> __________
> This email has been scanned for all viruses by the MessageLabs SkyScan
> service. For more information on a proactive anti-virus
> service working
> around the clock, around the globe, visit http://www.messagelabs.com
> ______________________________________________________________
> __________
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: To learn the basics of securing
> your web site with SSL, click here to get a FREE TRIAL of a Thawte
> Server Certificate: http://www.gothawte.com/rd524.html
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
>
-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing
your web site with SSL, click here to get a FREE TRIAL of a Thawte
Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user