jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ronnie" <lormee2...@yahoo.com.sg>
Subject WebRequest Disappears?
Date Sun, 06 Apr 2003 03:48:14 GMT
Hi all,

I've swiftly met another problem in my testing of servlet. I managed to user WebRequest in
my first test but in my second test in the same class, everything that was set disappears
and was replaced by null! I tried putting the test in another class but the result occurs.

Here's how my code was written:

  public class TestDispatcher1 extends ServletTestCase {

  public void setUp() throws Exception {
        jndiName = "ass2DB";
        addAccount(CUSTOMER2_FIRSTNAME, CUSTOMER2_LASTNAME, CUSTOMER2_ADDRESS,
                   CUSTOMER2_USERNAME, CUSTOMER2_PASSWORD, CUSTOMER2_EMAIL);
  }//setUp()

  public void tearDown() throws Exception {
        deleteAccounts();
        session.invalidate();
  }//tearDown()

  public void beginTestLogin(WebRequest request) throws Exception {
        request.addParameter("userName", CUSTOMER2_USERNAME);
        request.addParameter("password", CUSTOMER2_PASSWORD);
        request.addParameter("action", "login1");
  }//beginTestLogin()

  public void testLogin() throws Exception {
        System.out.println("User Name: "+request.getParameter("userName"));
        System.out.println("Password: "+request.getParameter("password"));
        System.out.println("Action: "+request.getParameter("action"));
        System.out.println("login1: "+config.getInitParameter("login1"));
  }//testLogin()

  }
All the "request.getParameter()" returns null and so does the config.getInitParameter(). I
have another test in this class which is set up the same way and works perfectly.

Any help is greatly appreciated!


Ronnie


Mime
View raw message