jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Cleber Jaraceski" <j...@kolnet.com.br>
Subject Session attributes doesn't work
Date Tue, 22 Oct 2002 19:09:18 GMT

I've done a JspTestCase with 2 tests (testT1 and testT2, see below).

And the testT1 I´ve set the session attribute "name" in my JSP page, but in
testT2 this attribute doens't exists.

I wan't use the beginT1 or beginT2 to set session attribute "name". Because
I have a lot of JSP (and Servlets) that set session attributes.

How can I do the session attributes to work correctly?

public void testT1() throws Exception {
  pageContext.forward( "/login.jsp");

public void testT2() throws Exception {
  pageContext.forward( "/home.jsp?name=" + (String)
pageContext.getAttribute( "name", pageContext.SESSION_SCOPE ) );

login.jsp (or Servlet, for example, with this code):
... <% pageContext.setAttribute( "name", "John",
pageContext.SESSION_SCOPE ); %> ...

home.jsp (or Servlet, for example, with this code):
... Hello, <%= (String) pageContext.getAttribute( "name",
pageContext.SESSION_SCOPE ); %> ...


P.S.: Sorry, but my english is not very well...

John Cleber Jaraceski
Sun Certified Java 2 Programmer

To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>

View raw message