Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Frame Work For Handling Forms

 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Makarand Parab
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go for Struts Framework.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic