D J wrote:

>
> Craig, thanks for the quick response.  I really like your solution.
>

Cool.

>
> Now assume I ignore your advice about defining a bean (whose
> properties are all of the entry fields on a form) and forwarding it
> to initialize the JSP entry form.
>

Boy, you must have *really* liked it :-)

>
> The first time the JSP page is accessed by the user (when there is no
> error), does the servlet have to create an "empty" error bean (with a
> null  message property) and pass that to the JSP file?  What if the
> user just bookmarks the JSP URL and circumvents the servlet forward?

Yes, if they click reload they won't see the error message ... until they try
to submit the form again, which will trigger the servlet validation and
regenerate the error.

Web applications (as opposed to web sites) need to be designed, and users to be
trained, to let the application control the navigation rather than the user.  I
contribute to this by running web-based apps in a separate browser window, with
minimal "chrome" (such as a toolbar or the location URL), so that you have to
know the keyboard shortcuts to even try any of these things.

>
> After reading the JSP .92 spec, it seems to imply that if an
> bean is not supplied to a JSP, the JSP will just create a new one
> automatically.  I suppose if the error bean defaults to a null
> message, this is fine, but it still seems like a waste.
>
> D J
>

I just go ahead and let the JSP page create an empty "error message" bean if
there isn't one, and make sure that the bean initializes itself to the state
where no message will be displayed.

Is it a waste?  I suppose so ... but conceptually it's not that much different
from initializing a string to zero length ("") instead of NULL so you don't
have to worry about null pointer errors later.  Come to think of it, there's
hardly any more work than that, because the code for the class will probably
have been loaded already.

Craig

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to