On Thu, 25 Oct 2001, David Smith wrote:
> Date: Thu, 25 Oct 2001 11:59:12 -0400
> From: David Smith <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: Re: how to keep form data
>
> I would like to add to that. It's a better user experience to do the
> validation on the client side since they don't have to actually submit and
> then wait for a reply, but definitely still validate on the server side as
> well. All data coming into a web server should be considered untrusted until
> proven otherwise. After all, the submission might come from one of your
> pages or some hacker trying to break/exploit your app.
This is good advice.
>
> As far as keeping form data, I tend to have the form submit data to the page
> it's in and then do some code to grab the data and process it. Then forward
> the user to the next page. Obviously do a quick check and if there is no
> form data skip the processing. If there's a problem, then just take the
> submitted form data and enter it back in the form with value="<%= ... %>"
> attributes.
>
Web application frameworks like Struts <http://jakarta.apache.org/struts>
solve this problem for you by associating the data on a particular form
with a JavaBean in either request scope or session scope, and use that
bean to automatically repopulate the form when it is redisplayed. There
are also a bunch of other nifty features -- check it out!
> --David Smith
>
Craig McClanahan