[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
[Home]
Session Beans
I can't seem to be able to create session beans. I have the following set-up:
The first page creates the following beans:
<%@ page session="true" errorPage="Error.jsp" %>
<jsp:useBean id="s" class="String" scope="session"></jsp:useBean>
<jsp:useBean id="v" class="java.util.Vector" scope="session"></jsp:useBean>
<jsp:useBean id="p" class="com.sts.jsp.SessionParameters"
scope="session"></jsp:useBean> <%
s = new String( "Test" );
v.add( "Test" );
Then the second page attempts to access the session beans:
<%@ page session="true" errorPage="Error.jsp" %>
<jsp:useBean id="s" class="String" scope="session"></jsp:useBean>
<jsp:useBean id="v" class="java.util.Vector" scope="session"></jsp:useBean>
//<jsp:useBean id="p" class="com.sts.jsp.SessionParameters"
scope="session"></jsp:useBean> <%
out.println( "s=" + s + "<BR>" );
out.println( "v.size=" + Integer.toString( v.size() ) + "<BR>" );
Here is the output:
s=
v.size=0
Also, I get a ClassCastException if I uncomment the //<jsp:useBean id="p"
class="com.sts.jsp.SessionParameters" scope="session"></jsp:useBean> line.
This indicates to me that there is a problem with my
com.sts.jsp.SessionParameters class because there is no ClassCastException
thrown for the java.util.Vector class.
Here is my com.sts.jsp.SessionParameter class:
import java.util.*;
import com.sts.exception.*;
public class SessionParameters {
private Hashtable PARAMETERS = new Hashtable();
private final String FILE = getClass().getName();
}
I am completly confused by what's going on here. Any help would be greatly
appreciated.
Chris Rae.