You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chance Terrell <ct...@friendlyworks.com> on 2000/07/05 21:04:54 UTC

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.

Thanks in Advance
Chance Terrell


p.s. Sorry about the pun.


Re: Documentation bug :-)

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Hans Gerwitz wrote:

> Now that I've finished making a fool of myself posting to the wrong list...
>
> In users_guide.html, section 3.3.0, the first JSP form element example does
> not use HTML entities to represent the < and > of all of the tags, making
> the tag look very simple, while the intention is to show how confusing it
> is!  At least in IE5/Mac.
>

Thanks ... this will be fixed tonight.

>
> While I'm posting here, Struts is remarkably similar to our
> internally-developed framework, with some notable design differences,
> particularly in form handling.  Is this an appropriate forum to discuss
> these issue (read: pick Craig's brain)... and in any event, are there any
> more suitable forums?  Most of my gems of wisdom have been gathered from the
> early days of various support lists (JServ, GNUJSP, Tomcat), which seems a
> shame.

The STRUTS-DEV list is designed for discussing "things I would like to
see added
or changed about Struts", while this list (STRUTS-USER) is better for
"how does
it work" and "why does it work that way" sorts of questions.  In truth,
I'm sure
there is a substantial overlap in readership as well.

There have also been a substantial number of discussions about
architectures
like Struts on the JSP-INTEREST@JAVA.SUN.COM mailing list, mostly under
keywords
"Model 2" or "MVC".  The archives of this list are available at
<http://archives.java.sun.com>.

>
> Thanks!
> ---
> Hans Gerwitz
> java@phobia.com

Craig

Documentation bug :-)

Posted by Hans Gerwitz <ja...@phobia.com>.
Now that I've finished making a fool of myself posting to the wrong list...

In users_guide.html, section 3.3.0, the first JSP form element example does
not use HTML entities to represent the < and > of all of the tags, making
the tag look very simple, while the intention is to show how confusing it
is!  At least in IE5/Mac.

While I'm posting here, Struts is remarkably similar to our
internally-developed framework, with some notable design differences,
particularly in form handling.  Is this an appropriate forum to discuss
these issue (read: pick Craig's brain)... and in any event, are there any
more suitable forums?  Most of my gems of wisdom have been gathered from the
early days of various support lists (JServ, GNUJSP, Tomcat), which seems a
shame.

Thanks!
---
Hans Gerwitz
java@phobia.com



Re: Documentation bug :-)

Posted by Hans Gerwitz <ja...@phobia.com>.
Doh!  That was merely a misaddressed message, it was intended for
struts-user.

Thanks, though :-)

> From: "Marius Sorin Barduta" <ma...@necomm.ro>
> Reply-To: tomcat-user@jakarta.apache.org
> Date: Fri, 7 Jul 2000 17:29:23 +0300
> To: <to...@jakarta.apache.org>, "Marius Sorin Barduta"
> <ma...@necomm.ro>
> Subject: Re: Documentation bug :-)
> 
> Boy, am I tired!!
> As you may have already guessed, to subscribe to struts-dev you have to send
> a message to struts-dev-subscribe@jakarta.apache.org
> not to struts-dev@jakarta.apache.org !
> 
>> 
>> To subscribe to the lists, send a message to:
>> <st...@jakarta.apache.org> or/and
>> struts-dev@jakarta.apache.org
>> 
> 
> Marius


Re: Documentation bug :-)

Posted by Marius Sorin Barduta <ma...@necomm.ro>.
Boy, am I tired!!
As you may have already guessed, to subscribe to struts-dev you have to send
a message to struts-dev-subscribe@jakarta.apache.org
not to struts-dev@jakarta.apache.org !

>
> To subscribe to the lists, send a message to:
>    <st...@jakarta.apache.org> or/and
> struts-dev@jakarta.apache.org
>

Marius


Re: Documentation bug :-)

Posted by Marius Sorin Barduta <ma...@necomm.ro>.
 > While I'm posting here, Struts is remarkably similar to our
> internally-developed framework, with some notable design differences,
> particularly in form handling.  Is this an appropriate forum to discuss
> these issue (read: pick Craig's brain)... and in any event, are there any
> more suitable forums?

Yes, there is  <st...@jakarta.apache.org> and
struts-dev@jakarta.apache.org!

To subscribe to the lists, send a message to:
   <st...@jakarta.apache.org> or/and
struts-dev@jakarta.apache.org

We'll welcome you to share your ideas with us (those already members) on
these two lists!

Marius







Documentation bug :-)

Posted by Hans Gerwitz <ja...@phobia.com>.
In users_guide.html, section 3.3.0, the first JSP form element example does
not use HTML entities to represent the < and > of all of the tags, making
the tag look very simple, while the intention is to show how confusing it
is!  At least in IE5/Mac.

While I'm posting here, Struts is remarkably similar to our
internally-developed framework, with some notable design differences,
particularly in form handling.  Is this an appropriate forum to discuss
these issue (read: pick Craig's brain)... and in any event, are there any
more suitable forums?  Most of my gems of wisdom have been gathered from the
early days of various support lists (JServ, GNUJSP, Tomcat), which seems a
shame.

Thanks!
---
Hans Gerwitz
java@phobia.com



RE: Server.HTMLEncode( String ) ?

Posted by "Rob S." <rs...@home.com>.
'allo Bruce,

> No, but it isn't too hard to implement yourself; there are only four
> characters you need to escape: <>&"

I'm more of the "even if its easy, why bother if it's already there" type of
guy.  I'm no expert on HTML, and thought maybe someone had something more
useful or that thought of something I didn't.  I ended up writing one last
nite just for the funk of it, in case there wasn't one.

> Why do you shiver at VBScript when you're willing to use JSP, which may
> be theoretically more elegant but isn't any easier in practice?

Hmm... everything being a variant, having to use it on an MS platform unless
you want to go with a p.o.s. like iASP and products like it, I think
Chilisoft's being the other.  I guess those would be two of the many
reasons, off the top of my head ;)

- r


Re: Server.HTMLEncode( String ) ?

Posted by br...@alum.mit.edu.
"Rob S." <rs...@home.com> writes:

> VBScript <shiver> has this.  It's a nice way to take otherwise 'bad' HTML
> for use in fields (no " allowed) and direct display (no <script>, etc.), and
> escape it.  Anything similar for Java/JSP/Servlets?

No, but it isn't too hard to implement yourself; there are only four
characters you need to escape: <>&"

Why do you shiver at VBScript when you're willing to use JSP, which may
be theoretically more elegant but isn't any easier in practice?  If you
really want to step up from VBScript, try my general-purpose BRL servlet
(free/open source software), which, among a lot of other things,
provides a function that does the HTML escape you asked about.

-- 
Bruce R. Lewis				http://brl.sourceforge.net/

Server.HTMLEncode( String ) ?

Posted by "Rob S." <rs...@home.com>.
VBScript <shiver> has this.  It's a nice way to take otherwise 'bad' HTML
for use in fields (no " allowed) and direct display (no <script>, etc.), and
escape it.  Anything similar for Java/JSP/Servlets?

- r


Re: Exceptional Question

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
"Rob S." wrote:

> > In the Struts framework (http://jakarta.apache.org/struts), I approached
> > this
> > issue by having a validate() method in my form bean return a String
> > array of
> > messages for all of the errors that have been detected, rather than
> > throwing
> > exceptions on individual fields.  That way, I can display all the errors
> > at
> > once.
>
> Ahhh k, those messages being keys to the MessageResource and set to the
> localized message, displayed using <struts:error/>.  I gave a preliminary
> read through the MVC intro doc, which was a rock and roll adventure.  I've
> only heard of it before, so it was sort of thick.  I'm sure the more
> experienced web people will probably get it a lot more quickly tho'.  What I
> *do* like is the use of an errors collection & keys, which makes things
> like:
>
> <%= errors.get(Bean.ATTR_ERROR) %>
>
> much cleaner than having to deal with individualized exceptions and more
> flexible than only being able to display the latest error.  Less powerful &
> efficient overall, but perhaps more appropriate for small-time sites (mine
> included).
>
> One thing I'm tempted to do is figure out elegant ways to only use
> get/setProperty to get all of my bean work done.  Doesn't usually turn out
> that way tho' =)  I wonder if the next JSP spec will provide more powerful
> bean tags.
>

There are two classes of "exceptional questions" that I've found do not really
fit the "check it in the bean setters" approach:

* Context-specific errors where there is more than one field
  involved (such as "field A is required if you selected checkbox B,
  but it must be blank otherwise").

* Errors that involve checking external resources ("is this really a
  valid customer identifier?").

In almost all cases, though, I have found that returning only one error message
at a time (which is what your original approach of returning exceptions on the
setters does) leads to incredible user frustration.  They really want to know
about *everything* they have to fix all at the same time -- otherwise, they are
unlikely to be repeat users of your application if they have any choice in the
matter.

In fact, this is why I use a "form bean" that is separate from the underlying
data objects (EJBs or whatever) -- the purpose of the form bean is to acquire a
semantically correct transaction, which is then processed in an "all or nothing"
manner.  As such, a form bean is really part of the View in an MVC architecture,
and should therefore be designed to meet view-related requirements, not
model-related requirements.

>
> - r

Craig McClanahan



RE: Exceptional Question

Posted by "Rob S." <rs...@home.com>.
> In the Struts framework (http://jakarta.apache.org/struts), I approached
> this
> issue by having a validate() method in my form bean return a String
> array of
> messages for all of the errors that have been detected, rather than
> throwing
> exceptions on individual fields.  That way, I can display all the errors
> at
> once.

Ahhh k, those messages being keys to the MessageResource and set to the
localized message, displayed using <struts:error/>.  I gave a preliminary
read through the MVC intro doc, which was a rock and roll adventure.  I've
only heard of it before, so it was sort of thick.  I'm sure the more
experienced web people will probably get it a lot more quickly tho'.  What I
*do* like is the use of an errors collection & keys, which makes things
like:

<%= errors.get(Bean.ATTR_ERROR) %>

much cleaner than having to deal with individualized exceptions and more
flexible than only being able to display the latest error.  Less powerful &
efficient overall, but perhaps more appropriate for small-time sites (mine
included).

One thing I'm tempted to do is figure out elegant ways to only use
get/setProperty to get all of my bean work done.  Doesn't usually turn out
that way tho' =)  I wonder if the next JSP spec will provide more powerful
bean tags.

- r


Re: Exceptional Question

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
In the Struts framework (http://jakarta.apache.org/struts), I approached
this
issue by having a validate() method in my form bean return a String
array of
messages for all of the errors that have been detected, rather than
throwing
exceptions on individual fields.  That way, I can display all the errors
at
once.

Craig McClanahan


"Rob S." wrote:

> Hi Chance,
>
> I'm running into the same kind of thing using Beans for form validation.  I
> wonder if there's a nice/standard way to do this?  I went the flag route, so
> I don't have localized error reporting on my page - adjacent to appropriate
> field(s).  I see what you're saying.  Multiple properties are throwing
> exceptions...  Maybe someone else will reply soon before we eventually
> figure it out ;)
>
> #1) In fillOutForm.jsp
> #2) Submit to addressbook_save.jsp
> #3) Oops!  Exception, error page to addressbook_entry.jsp
>
> At the beginning of addressbook_entry.jsp, you set all the properties again:
>
> > > <jsp:useBean  id="SessionBean" scope="session"
> class="fw.web.session.fwWebAddressBook" />
> > > <jsp:setProperty name="SessionBean" property="*" />
>
> Why do you need to do that if the Bean is at session scope?  Won't they
> already have been set on the previous page - addressbook_save.jsp - when the
> user pressed Submit before?  One thing I'm not sure of is if request data is
> sent along to the error page.  If not, the setProp line has no effect since
> there's nothing there.  If the request stuff is passed, won't this throw all
> the same exceptions again?
>
> BTW: when you get the "unhandled exception" it's the second exception?
>
> I'm gone all day, but I'm very interested in getting to the bottom of this.
> Please cc: responses to rslifka@sfu.ca because I don't get the Tomcat user
> list sent to that box =)
>
> - r
>
> > -----Original Message-----
> > From: Chance Terrell [mailto:cterrell@friendlyworks.com]
> > Sent: July 6, 2000 7:14 AM
> > To: tomcat-user@jakarta.apache.org
> > Subject: RE: Exceptional Question
> >
> >
> > 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

RE: Exceptional Question

Posted by "Rob S." <rs...@home.com>.
Hi Chance,

I'm running into the same kind of thing using Beans for form validation.  I
wonder if there's a nice/standard way to do this?  I went the flag route, so
I don't have localized error reporting on my page - adjacent to appropriate
field(s).  I see what you're saying.  Multiple properties are throwing
exceptions...  Maybe someone else will reply soon before we eventually
figure it out ;)

#1) In fillOutForm.jsp
#2) Submit to addressbook_save.jsp
#3) Oops!  Exception, error page to addressbook_entry.jsp

At the beginning of addressbook_entry.jsp, you set all the properties again:

> > <jsp:useBean  id="SessionBean" scope="session"
class="fw.web.session.fwWebAddressBook" />
> > <jsp:setProperty name="SessionBean" property="*" />

Why do you need to do that if the Bean is at session scope?  Won't they
already have been set on the previous page - addressbook_save.jsp - when the
user pressed Submit before?  One thing I'm not sure of is if request data is
sent along to the error page.  If not, the setProp line has no effect since
there's nothing there.  If the request stuff is passed, won't this throw all
the same exceptions again?

BTW: when you get the "unhandled exception" it's the second exception?

I'm gone all day, but I'm very interested in getting to the bottom of this.
Please cc: responses to rslifka@sfu.ca because I don't get the Tomcat user
list sent to that box =)

- r

> -----Original Message-----
> From: Chance Terrell [mailto:cterrell@friendlyworks.com]
> Sent: July 6, 2000 7:14 AM
> To: tomcat-user@jakarta.apache.org
> Subject: RE: Exceptional Question
>
>
> 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


RE: Exceptional Question

Posted by Chance Terrell <ct...@friendlyworks.com>.
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


RE: Exceptional Question

Posted by "Rob S." <rs...@home.com>.
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
>


RE: Exceptional Question

Posted by Chance Terrell <ct...@friendlyworks.com>.
1)	I have multiple fields on the form
2) 	each field has a corresponding individual set method in the session bean
3)	each set method has it's own try and catch statements and generates a
unigue exception
4)	submiting the form causes jsp/tomcat/whatever to call all the set methods
		<jsp:setProperty name="SessionBean" property="*" />
	in one fell swoop
5)	goto (1) -- the form page is also the error page

There may be no way to handle exceptions in this manner, but I was hoping
maybe a Tomcat Developer(maybe even the one who is responsible for
exceptions) might stick his head in and give me a definite yea or nea. or
someone might be able to point me in the right direction

thanks for your help
and
good luck on your project
Chance
 -----Original Message-----
From:
tomcat-user-return-6060-cterrell=friendlyworks.com@jakarta.apache.org
[mailto:tomcat-user-return-6060-cterrell=friendlyworks.com@jakarta.apach
e.org]On Behalf Of Rob S.
Sent: Wednesday, July 05, 2000 3:29 PM
To: tomcat-user@jakarta.apache.org
Subject: RE: Exceptional Question


I guess my lack of understanding is how you're able to throw 2 exceptions
w/out catching one first?  e.g.

try {
	throw something
	// you'll never get here
} catch (something) {
	// here we are!
} finally {
	// at last!
}

So here's your flow of control:

Some JSP page, throws unhandled --> error page, handling it.

Please revise the above line include how you're throwing 2 exceptions.

Am I on the right track here?  Course project due in 45 minutes, so I'm a
littly fuzzy right now =)

- r

> -----Original Message-----
> From: Chance Terrell [mailto:cterrell@friendlyworks.com]
> Sent: July 5, 2000 12:39 PM
> To: tomcat-user@jakarta.apache.org
> Subject: RE: Exceptional Question
>
>
> 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
>
>
>
>
> --------------------------------------------------------------------------
> 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


RE: Exceptional Question

Posted by "Rob S." <rs...@home.com>.
I guess my lack of understanding is how you're able to throw 2 exceptions
w/out catching one first?  e.g.

try {
	throw something
	// you'll never get here
} catch (something) {
	// here we are!
} finally {
	// at last!
}

So here's your flow of control:

Some JSP page, throws unhandled --> error page, handling it.

Please revise the above line include how you're throwing 2 exceptions.

Am I on the right track here?  Course project due in 45 minutes, so I'm a
littly fuzzy right now =)

- r

> -----Original Message-----
> From: Chance Terrell [mailto:cterrell@friendlyworks.com]
> Sent: July 5, 2000 12:39 PM
> To: tomcat-user@jakarta.apache.org
> Subject: RE: Exceptional Question
>
>
> 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
>
>
>
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
>


RE: Exceptional Question

Posted by Chance Terrell <ct...@friendlyworks.com>.
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




RE: Exceptional Question

Posted by "Rob S." <rs...@home.com>.
> 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