• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why validation at struts ?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why cant data validation be done at client side using javascripts ??
Itsnt it easier and faster ?
Is there any adavantage of using struts validator ??
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The struts validator will actually generate Javascript for you, if you so choose.
Personally, I don't use Javascript validation. While the dialog box is convenient, the formatting and placement of the error messages is not to my liking. Also, if the user turns off Javascript, what happens then? I still have to validate server-side. This way they get a consistent interface from me.
However, others prefer the faster Javascript validation and the consistent display of error messages isn't that important.
Hope that helps.
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, Struts validation supports client-side validation as well as server-side validation for simple validators. Basically, client-side validation is a nice extra but it can never completely replace server-side validation.
1) Some validations need more context than the current page and therefore client-side validation would be difficult.
2) Invalid data should never be allowed make it to the datasource and this can only be guaranteed by server-side validation. Remember, it is conceivable that the user could turn off javascript and completely bypass your client-side validation.
For the above reasons, most applications make use of a combination of both client-side and server-side validation.
 
Aneesh Kumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot guys
These were valuble new insights .
I guess i will use both validations ..

Regards
Aneesh
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, these client-side / server-side validations drive me nuts
I am just a low level flunkey doing what the project leads and tech leads ask me to do. But I am going mad trying to figure out how to make certain fields read-only based on dynamic user choices, or how to display certain contents only in certain situations and how to scroll down pages to show certain areas without using javascript.
The business team asks for all these stuff to give a better 'user experience' and the tech leads say "Oh my god. u used javascript! No " and I feel like tearing my hair figuring these things out.
If you have any experience being in a similar situation, maybe u can help out by posting some tips on the "SetFocus on re-displayed page" thread!
I would really appreciate it.
[ February 26, 2004: Message edited by: anu ramk ]
reply
    Bookmark Topic Watch Topic
  • New Topic