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 Thu, 06 Jul 2000 14:13:30 GMT
Correction #5 should read:

5) a. If everything is filled in and in the proper format goto
addressbook_save.jsp
   b. if there are any problems/exceptions goto addressbook_entry.jsp


...meaning submit to a confirmation page if all required data is present and
in the proper format. Otherwise loop.

I understand what you are saying about a single thread, and maybe I am
chasing rabbits. But, when I test the pages and enter information correctly
in all of the required fields it works appropriately. If I enter information
correctly in all of the required fields but one it works appropriately.So
the pages work in an almost error free world  ;) I have tried all of the
fields individually and each one works correctly as long as it is the only
exception on the page at that time. If I make two or more mistakes at a time
I don't get my entry page as an error page I get a page that says "unhandled
exception" and that I might want to consider adding an error page.

The workaround is to catch all exceptions in the bean, set flags
corresponding to the correct and incorrect fields, throw a single new
exception for the whole page. From the page when it catches the exception to
then call a function that tells me the state of the flags. I can do it. It
will work, but I was trying to let each object/field handle its own error
state without a third party intervening(seamed cleaner that way).

Chance

-----Original Message-----
From:
tomcat-user-return-6071-cterrell=friendlyworks.com@jakarta.apache.org
[mailto:tomcat-user-return-6071-cterrell=friendlyworks.com@jakarta.apach
e.org]On Behalf Of Rob S.
Sent: Wednesday, July 05, 2000 6:55 PM
To: tomcat-user@jakarta.apache.org
Subject: RE: Exceptional Question


import slifka.rob.speculation;

A single thread is spawned per request.  Only one exception can be thrown at
a time, per thread (re: snippet previously typed up).  So we can rule out
having to deal with multiple exceptions in the air at once.  I doubt Tomcat
is spawning 1+ threads to match up all of your request params with your
properties.

Here's my attempt to piece together the file(s) in question.  You first
mention:

> 5)	goto (1) -- the form page is also the error page

So right off the bat, these two things should match, correct?

> > <%@ page errorPage="./addressbook_entry.jsp" %>
> > <FORM action  = "./addressbook_save.jsp"

Saying, "Submit to myself, and I am my own exception handler"?  Otherwise,
I'm not sure what your #5 means.

- r

> > <%@ 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
> >
> >
> >
> >
> >
> --------------------------------------------------------------------------
> > To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commmands, email: tomcat-user-help@jakarta.apache.org
> >
>
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
>
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
>


--------------------------------------------------------------------------
To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
For additional commmands, email: tomcat-user-help@jakarta.apache.org


Mime
View raw message