aspose file tools*
The moose likes Servlets and the fly likes Frame Work For Handling Forms Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Frame Work For Handling Forms" Watch "Frame Work For Handling Forms" New topic
Author

Frame Work For Handling Forms

Luke Shannon
Ranch Hand

Joined: Sep 30, 2004
Posts: 239
Hello;

I am working on a project where I am receiving input from a bunch of forms, inputting that to a database and displaying previous data submitted by that form (people need to see what they did last time as they fill out the form).

It is a lot of work in the servlet and jsp area. Although it works it will not be fun to maintain. It got me thinking. There has to be some framework I can be using within a servlet to handle/simplify these tasks.

Anyone know of anything like this?

Thanks,

Luke


Luke
SCJP
Makarand Parab
Ranch Hand

Joined: Dec 10, 2004
Posts: 121
Go for Struts Framework.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

Adopting Struts just to handle form input is a bit extreme, in my opinion.

Luke, what you are doing sounds pretty simple and straight-forward to me. What parts are you finding onerous? Are you perhaps over-thinking/over-engineering the problem?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Luke Shannon
Ranch Hand

Joined: Sep 30, 2004
Posts: 239
Well I have 5 forms.

They are pretty large.

Each time one loads up I display all the previous posted results in the top (this is done by passing a Java object containing the table headers and data from the Servlet to the JSP).

When you submit it gets validated and sent to the DB (meaning they decide what values are required and what they should be for form data to be added to the DB - this is done from an admin view of application).

The validation needs to be dynamically configured by users of the application.

I am having trouble figuring out the validation component.

Also if I change the form I need to update the JSP, the servlet it posts too, the java class that read/writes to the DB and the DB itself.

I am hoping to easily be able to add and remove forms and have users set the form validation as they see fit.

My present design of JSP <-> Servlets <-> Java Classes <-> DB works fine enough. I guess I am looking for something more configurable and scalable.

Thanks,

Luke
[ October 17, 2005: Message edited by: Luke Shannon ]
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
Spring coupled with some type of JDO, like Hibernate, might work well in this situation. But I agree with Bear... make sure you are not overcomplicating the project by adding a framework just for the sake of adding it.


“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
Luke Shannon
Ranch Hand

Joined: Sep 30, 2004
Posts: 239
Spring looks pretty cool.

Spring Tutorial - Section On Adding Forms

Looks like they have something in place to handle validation. I need to look over this a bit more. I don't want to make things more complicated. I am looking for something that will simplify my life.

Luke
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
If you decide to go with Spring, I would highly recommend getting Pro Spring by Harrop and Machacek. It is a very good introduction to Spring and even shows you how to use it within Web Applications.

For my money, I think Spring is a lot less complicated than Struts. But as with any framework, there are times when struts is most appropriate and times when Spring is. (Heck, the two aren't mutually exclusive either. I have seen at least one web app that used both rather successfully)
[ October 17, 2005: Message edited by: Paul Bourdeaux ]
Seb Mathe
Ranch Hand

Joined: Sep 28, 2005
Posts: 225
I use Spring & Struts together.

I would'nt say that Spring is less complicated than Struts, because it includes several other things than a Web Fmk.

Have a look at Struts (and its form-validation features), and if you understand globally how it works you should be able to use it quickly.


Regards,<br />Seb<br /> <br />SCJP 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Frame Work For Handling Forms