Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Managibility, Propagation, Form Validation, and getting rid of js  RSS feed

 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have several pages with several forms on them, some are unique and some aren't. The problem with our current implimentation of JSP and Javascript is that there is a massive amount of code within each page and in order to make a common change you must edit every single page. We want to move to a model where the front end stuff is seperated from the back end; the designers don't have to scroll through text that doesn't concern them, but they can still do their job without bugging the programmers. We want to be able to edit one page, or one form, or one component, and have it propagate every where it is used. We currently have Javascript handeling form validation! Ewww!

An example of our current model: To kick things off a radio button is selected and then depending on the option more items appear... right now the forms/items are just hidden and then revealed by javascript... this is ugly for both client and programer. another problem with the current version is that if there is more then 5000 charecters in a text box a message the "form validation" we have set in place gives a error message... and then wipes out everything they have Which is NOT ideal.

What do you suggust we do inorder to solve these problems? Should I bring in jsf or tapastry or whatever?
any thoughts, ideas, comments?

I'm in desprate need of help! any would be endlessly apreciated!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, investigate the concepts "Model 2" and "MVC". This is a pattern for separating the concerns of your application into managable layers.

Secondly, while Javascript validation can be a good thing for the "user experience" (e.g. quick notification of entry errors) it should never be relied upon. All validations must occur (or be repeated) on the server side.

Adopting a framework might be a possiblity for you, but I'd refrain from a wholesale adoption until you've got a good handle on the Model 2/MVC pattern so you can make a determination if a framework is appropriate for you, and if so, which framework to adopt.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at existing frameworks is always a good idea, Tapestry, Struts, Tiles, etc.....

You don't have to use a framework, however, to have a well constructed 'Model, View, Controller' (MVC) application. I have a site full of servlet examples that are almost all written in an MVC pattern.

One project, the Dynamic Select Lists app, works much like the requirement you have described. The user picks a value from one list and the other list updates itself according to what they picked. http://simple.souther.us/not-so-simple.html

If you look at the JSP code in that example, there is almost no JS other than an onclick event to submit the form.


[yet, another collision with Bear B.]
[ July 15, 2005: Message edited by: Ben Souther ]
 
Yong Bakos
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daniel, you say that to make a change, you must do it across a whole set of pages. If your javascript code is not being loaded from an external source, there's a great first step at refactoring. Another would be implementing server-side validation classes (especially if you feel that moving your app into a framework is too big of an initial leap).

My rule of thumb has always been to use client-side validiation in a lightweight manner, and server-side validation heavily.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!