File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Server-side validation Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Server-side validation" Watch "Server-side validation" New topic
Author

Server-side validation

Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Posts: 151
Hello ranchers,

I have an application in which I have to do a server-side validation. It happens because according to the selected project (entity) in a drop-down list a certain period of date (text box) is allowed. My problem is that I can't keep the fields with the value inserted if that validation occurs to return false. How can I "save" the values in the fields so when the validation completes they still have them?
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 48799

Use the input elements' value attribute to set the initial value of the controls when you return to the page after failing validation.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Posts: 151
That's what I have in mind. My problem is where (and how) do I store the values typed by the user before he had clicked the confirm button. The fields are initially blank.
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 48799

Why do you care what's in the fields before submission? Only the values that are submitted are important -- and you obviously have those in hand as you are validating them.

This message was edited 1 time. Last update was at by Bear Bibeault

Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Posts: 151
You cleared my mind, thanks.
 
jQuery in Action, 2nd edition
 
subject: Server-side validation
 
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com