tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chance Terrell" <cterr...@friendlyworks.com>
Subject RE: Exceptional Question
Date Wed, 05 Jul 2000 19:38:59 GMT
If some one types in a bad Name (starts with a number) and fills out
everything else correctly I generate one exception and this page handles it
correctly. However if someone types in a bad name and a invalid email
address, I generate two exceptions one for each field and I get an unhandled
exception error. Is there a Exception Vector or array for the error page?

jsp code as requested...


<%@ page info="Addressee's information entry" %>
<%@ page errorPage="./addressbook_entry.jsp" %>
<%@ page isErrorPage="true" %>
<%@ page import="fw.web.session.*" %>
<%@ page import="fw.web.fwDateException" %>
<jsp:useBean  id="SessionBean" scope="session"
class="fw.web.session.fwWebAddressBook" />
<jsp:setProperty name="SessionBean" property="*" />
<HTML>
  <HEAD>
    <TITLE>
      Acme Address Book
    </TITLE>
  </HEAD>
  <BODY   background  = "../images/background.jpg"
          alink       = "#da7f14"
          link        = "#004081"
          vlink       = "#da7f14"
          text        = "#000000"  >
    <FONT face = "Arial, Helvetica, Univers, Sans Serif"  >
      <IMG  alt     = "Welcome to FriendlyWorks!"
            border  = "0"
            hspace  = "0"
            id      = "IMG1"
            src     = "../images/smallbanner.gif"  >
      <TABLE  cellpadding = "0"
              cellspacing = "0"
              border      = "0"
              width       = "600" >
        <TR valign = "top" >
  	  <TD align = "left"  >
            <TABLE  cellpadding = "0"
                    cellspacing = "0"
                    border      = "0"
                    width       = "130" >
              <TR>
                <TD>
                  <jsp:include page="./navigation.jsp" flush="true" />
                </TD>
              </TR>
            </TABLE>
	  </TD>
	  <TD>
            <FORM action  = "./addressbook_save.jsp"
                  method  = "post"  >
              <TABLE  width       = "500"
                      border      = "0"
                      cellspacing = "0" >
                <TR>
                  <TD>
                    <H2>Address Book Entry</H2>
                  </TD>
                </TR>
                <TR>
                  <TD>
<% if(exception instanceof fwRequiredDataException) { %>
                      The fields you did not complete properly are
highlighted
                      in red below. Please make the neccesary corrections
and
                      then press the 'Submit' button.
<% } else { %>
                      To add yourself to
                      <%= SessionBean.Subscriber("%f %pl") %>
                      address book, fill out the entire form below and then
                      press the 'Submit' button.
<% } %>
                  </TD>
                </TR>
                <TR>
                  <TD height  = "20" >
                    <BR>
                  </TD>
                </TR>
              </TABLE>
              <TABLE  width       = "500"
                      border      = "0"
                      cellspacing = "0" >
                <TR>
                  <TD width = "220" >
                    <B>
<% if(exception instanceof fwAddrFirstException){ %>  <FONT color =
"#FF0000" > <% } %>
                        First Name *
<% if(exception instanceof fwAddrFirstException){ %>  </FONT> <% } %>
                    </B>
                    <BR clear = "all" >
                    <FONT size  = "+1"  >
                      <INPUT  type      = "text"
                              name      = "firstName"
                              value     = "<jsp:getProperty
name="SessionBean" property="firstName" />"
                              maxlength = "50"
                              size      = "28"
                              tabindex  = "1" >
                    </FONT>
                  </TD>
                  <TD width   = "60" >
                    <B>
<% if(exception instanceof fwAddrInitialException){ %>  <FONT color =
"#FF0000" > <% } %>
                      M.I.
<% if(exception instanceof fwAddrInitialException){ %>  </FONT> <% } %>
                    </B>
                    <BR clear = "all" >
                    <FONT size  = "+1"  >
                      <INPUT  type      = "text"
                              name      = "middleInitial"
                              value     = "<jsp:getProperty
name="SessionBean" property="middleInitial" />"
                              maxlength = "1"
                              size      = "3"
                              tabindex  = "2" >
                    </FONT>
                  </TD>
                  <TD width = "220" >
                    <B>
<% if(exception instanceof fwAddrLastException){ %>  <FONT color = "#FF0000"
> <% } %>
                        Last Name *
<% if(exception instanceof fwAddrLastException){ %>  </FONT> <% } %>
                    </B>
                    <BR clear = "all" >
                    <FONT size  = "+1"  >
                      <INPUT  type      = "text"
                              name      = "lastName"
                              value     = "<jsp:getProperty
name="SessionBean" property="lastName" />"
                              maxlength = "50"
                              size      = "28"
                              tabindex  = "3" >
                    </FONT>
                  </TD>
                </TR>
              </TABLE>
              <TABLE  width       = "500"
                      border      = "0"
                      cellspacing = "0" >
                <TR>
                <TR>
                  <TD height  = "20" >
                    <B>
<% if(exception instanceof fwAddrEmailException){ %>  <FONT color =
"#FF0000" > <% } %>
                        E-mail Address *
<% if(exception instanceof fwAddrEmailException){ %>  </FONT> <% } %>
                    </B>
                    <BR clear = "all" >
                    <FONT size  = "+1"  >
                      <INPUT  type      = "text"
                              name      = "emailAddress"
                              value     = "<jsp:getProperty
name="SessionBean" property="emailAddress" />"
                              maxlength = "50"
                              size      = "67"
                              tabindex  = "4" >
                    </FONT>
                  </TD>
                </TR>
              </TABLE>
              <TABLE  width       = "500"
                      border      = "0"
                      cellspacing = "0" >
                <TR>
                <TR>
                  <TD width = "40%" >
                    <B>
<% if(exception instanceof fwRequiredDataException){ %>  <FONT color =
"#FF0000" > <% } %>
                        Relationship *
                        <BR>
                        to Resident
<% if(exception instanceof fwRequiredDataException){ %>  </FONT> <% } %>
                    </B>
                    <BR clear = "all" >
                    <FONT size  = "+1"  >
                      <SELECT name      = "relationship"
                              size      = "1"
                              tabindex  = "5" >
                        <OPTION> <jsp:getProperty name="SessionBean"
property="relationship" />
                        <OPTION> Granddaughter
                        <OPTION> Grandson
                        <OPTION value = "Great_Granddaughter" > Great
Granddaughter
                        <OPTION value = "Great_Grandson"  > Great Grandson
                        <OPTION> Daughter
                        <OPTION> Son
                        <OPTION> Sister
                        <OPTION> Brother
                        <OPTION> Mother
                        <OPTION> Father
                        <OPTION> Aunt
                        <OPTION> Uncle
                        <OPTION> Niece
                        <OPTION> Nephew
                        <OPTION value = "Other_Relative_(Female)" > Other
Relative (Female)
                        <OPTION value = "Other_Relative_(Male)" > Other
Relative (Male)
                        <OPTION value = "Friend_(Female)" > Friend (Female)
                        <OPTION value = "Friend_(Male)" > Friend (Male)
                      </SELECT>
                    </FONT>
                  </TD>
                  <TD width = "30%" >
                    <B>
<% if(exception instanceof fwDateException){ %>  <FONT color = "#FF0000" >
<% } %>
                        Birth Date *
                        <BR>
                        (mm/dd/yyyy)
<% if(exception instanceof fwDateException){ %>  </FONT> <% } %>
                    </B>
                    <BR clear = "all" >
                    <FONT size  = "+1"  >
                      <INPUT  type      = "text"
                              name      = "birthDay"
                              value     = "<jsp:getProperty
name="SessionBean" property="birthDay" />"
                              size      = "16"
                              maxsize   = "10"
                              tabindex  = "6" >
                    </FONT>
                  </TD>
                  <TD width = "30%" >
                    <B>
<% if(exception instanceof fwDateException){ %>  <FONT color = "#FF0000" >
<% } %>
                      Anniversary Date
                      <BR>
                      (mm/dd/yyyy)
<% if(exception instanceof fwDateException){ %>  </FONT> <% } %>
                    </B>
                    <BR clear = "all" >
                    <FONT size  = "+1"  >
                      <INPUT  type      = "text"
                              name      = "anniversary"
                              value     = "<jsp:getProperty
name="SessionBean" property="anniversary" />"
                              size      = "16"
                              maxsize   = "10"
                              tabindex  = "7" >
                    </FONT>
                  </TD>
                </TR>
                <TR>
                  <TD height  = "20"
                    <BR>
                  </TD>
                </TR>
              </TABLE>
              <TABLE  width       = "500"
                      border      = "0"
                      cellspacing = "0" >
                <TR>
                <TR>
                  <TD align   = "center"  >
                    <INPUT  type      = "image"
                            name      = "savebttn"
                            src       = "../images/submit_bttn.gif"
                            width     = "80"
                            height    = "20"
                            border    = "0"
                            tabindex  = "8" >
                    <A  href  = "./addressbook_exit.jsp"  >
                      <IMG  src       = "../images/cancel_bttn.gif"
                            width     = "80"
                            height    = "20"
                            border    = "0"
                            hspace    = "5"
                            tabindex  = "9" >
                    </A>
                  </TD>
                </TR>
                <TR>
                  <TD>
<% if(exception instanceof fwRequiredDataException){ %><FONT color =
"#FF0000" > <% } %>
                      * Required fields
<% if(exception instanceof fwRequiredDataException){ %></FONT> <% } %>
                  </TD>
                </TR>
                <TR>
                  <TD height  = "20">
                    <BR>
                  </TD>
                </TR>
                <TR>
                  <TD>
                    <P>
                      Acme will use the relationship and date information
you furnish to provide our users, and you, with e-mail reminders.
                      For example, a week before your birthday, <%=
SessionBean.Subscriber("%f %l") %> will receive an automated e-mail from
Acme
                      reminding them that your birthday is only a week away.
Acme will also send you an e-mail reminder one-week
                      before <%= SessionBean.Subscriber("%f %pl") %>
birthday.
                    </P>
                  </TD>
                </TR>
                <TR>
                  <TD height  = "20" >
                    <BR>
                  </TD>
                </TR>
                <TR>
                  <TD>
                    <P>
                      Acme is committed to protecting the privacy of your
personal
                      information.  We may use information we gather from
you to personalize our
                      customers' e-mail and Internet experience or to update
you about our
                      products and services.  We will not disclose any
individual personal
                      information to third parties without obtaining prior
approval.
                    </P>
                  </TD>
                </TR>
              </TABLE>
            </FORM>
            <jsp:include page="./footer.jsp" flush="true" />
          </TD>
	</TR>
      </TABLE>
    </FONT>
  </BODY>
</HTML>
-----Original Message-----
From:
tomcat-user-return-6058-cterrell=friendlyworks.com@jakarta.apache.org
[mailto:tomcat-user-return-6058-cterrell=friendlyworks.com@jakarta.apach
e.org]On Behalf Of Rob S.
Sent: Wednesday, July 05, 2000 2:08 PM
To: tomcat-user@jakarta.apache.org
Subject: RE: Exceptional Question


> How do you handle multiple exceptions in JSP/Tomcat on a single page?
>
> ie... a form with multiple fields each with it's own set method that
> generates an exception if format is violated. With one or less exceptions,
> it works properly, two or more and I get an unhandled exception message.

Not exactly sure what you mean.  Would you be able to attach the JSP or a
code snippet?  If not appropriate to the list, to me @ rslifka@home.com
then.

> p.s. Sorry about the pun.

=)

- r




Mime
View raw message