tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Heinemann <>
Subject JSP file not finding object
Date Fri, 02 Jun 2000 18:10:37 GMT
Hi everybody,

I have a slight problem.  With a servlet I create a Vector filled with
Strings (error messages).  I add that to the session.  After that I
redirect to a JSP.  The JSP can't get the value back out of the
session.  Here is the relivant code:
         System.out.println  ((String)req.getParameter ("ANSWER"));

     p.setAnswer ( (String)req.getParameter ("ANSWER"));
 }catch (Exception e){
     errors.add (e.getMessage ());
         System.out.println  ((String)req.getParameter ("PASS1"));
     System.out.println  ((String)req.getParameter ("PASS2"));

     String pass1 = (String)req.getParameter ("PASS1");
     String pass2 = (String)req.getParameter ("PASS2");
     if (pass1.equals (pass2)){
  p.setPassword ( (String)req.getParameter ("SSN"));
  p.setPassword (null);
 }catch (Exception e){
     errors.add (e.getMessage ());

 for (int i=0;i<errors.size();i++){
     System.out.println ((String)errors.elementAt (i));

 session.setAttribute ("errors",errors);

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
 <title>Please complete the form to create your account.</TITLE>
<body bgcolor=#FFFFFF >

<TABLE width="100%" cellpadding=2 cellspacing=0 valign="top"
align="middle" >

 <% Vector errors = (Vector) session.getAttribute ("errors");
  if (errors != null){
   if (errors.size() > 0){
    <% for (int i=0;i<errors.size();i++){
     %><LI><%=(String)errors.elementAt(i) %>
    <% } %></UL><%
 %><%=(String)session.getAttribute ("TIME")%><% }
 Please complete all fields.<BR>
 <form action="/servlet/" method="Get" >
  <input type="hidden" name="ACTION" value="REGISTER" >
  Your social security number : <input type="text" name="SSN" ><BR>
  The password you would like : <input type="password" name="PASS1"
  Your password again : <input type="password" name="PASS2" ><BR>
  Your email address : <input type="text" name="EMAIL" ><BR>
  Your hint question: <input type="text" name="HINT" ><BR>
  Your hint answer : <input type="text" name="ANSWER" ><BR>
  Your account number : <input type="text" name="CONTRACTNUM" ><BR>

  <input type="submit" name="Submit Request for an Account"
>&nbsp;&nbsp;<input type="reset" ><BR>


Any help is appreciated....

Chris Heinemann

View raw message