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 Input field and form ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Input field and form ?" Watch "Input field and form ?" New topic
Author

Input field and form ?

ashish kulkarni
Ranch Hand

Joined: Aug 15, 2002
Posts: 130
Hi,
I have a data entry page in jsp, where there are 10 textfields for input, the user will enter data in these fields and press enter, then i want to take this data from input field and pass to a validating bean , this bean will validate the data, if the data is valid it will update the database, and return true, and if the data is not valid return false,
so if the result is true, i want to send the success message and blank the entry fields which happens because i am submitting the form, or if the result is false, i want to retain all the data entered by the user on the screen and display the error messages.
But when i sumbit the form all the fields get intialized and then i have to put those back in session and reload them on the jsp page.
Is there a better way, has anyone designed this kind of arctiecture


A$HI$H
Shawn Bayern
Author
Ranch Hand

Joined: May 06, 2002
Posts: 160
Originally posted by kulkarni_ash:
But when i sumbit the form all the fields get intialized and then i have to put those back in session and reload them on the jsp page.
Is there a better way, has anyone designed this kind of arctiecture

You might be interested in the 'Input Taglib' at Jakarta Taglibs (http://jakarta.apache.org/taglibs) that I wrote some years ago. It's not actively maintained, but I believe it provides the specific feature you're looking for: it ties the form fields to the values that the user previously chose.
It's somewhat more common to use a framework like Struts that provides associated taglibs to tie the value of form fields to some back-end data.


Shawn Bayern<br />"JSTL in Action" <a href="http://www.jstlbook.com" target="_blank" rel="nofollow">http://www.jstlbook.com</a>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

And, escpecially if you are forwarding back to the original page, it's pretty easy to roll your own. Remember that in the case of a forward, the original request parameters are still there on the request, and you can add as many attributes to the request as you need to tell your page what to do.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
ashishkulkarni,
JavaRanch has a Naming Policy Following it is a requirement for winning a book. Please read it and change your name to comply.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Input field and form ?