• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

DWR vs Spring MVC Validator

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Frank,

I'm new to DWR, having used it for the first time just last week. I'm curious about what effect using DWR to validate a field on a form would have for a controller validator (Spring MVC). If I know that DWR has validated a field's value before being submitted, do you think there is still a need to use a validator class? I'm thinking if a form's values are validated by DWR before a form is submitted, there's no need for the validator.

Regards,
Brian Smith
 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, DWR in and of itself can't validate anything, so I'd say the implications of Spring make that assumption is, well, pretty bad for security! LOL

I have to admit up-front that I'm really not familiar with the validation features Spring offers. But, DWR allows you to call server-side code, so my *assumption* is that you could call on Spring from your Javascript code to do validations, which would in some ways make doing it again on form submission in Spring redundant. Then again, double-validation of user input is *never* redundant, so take that statement with a grain of salt

Also, since DWR makes calls through it's own servlet, I don't even think they would coexist in the sense that you couldn't use DWR to call through to Spring MVC because, as I recall, Spring MVC has it's own servlet, so it'd be like two competing controllers, which usually doesn't work.
 
Brian E Smith
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I added the DWR entries to my web.xml, in addition to the entries for my DispatcherServlet. In dwr.xml, I described the object (which I named DWRLogonValidator) that I wanted my JSP to use to validate the individual fields on the form. In the JSP, I added the .js includes that DWR generates. It "works" as I think it should, and this mean that the data has to pass my DWR validator before I actually submit the form to the controller. So I guess my DWR validator doesn't necessarily have to supercede or make obsolete my Spring validator; I suppose they could complement each other.

Regards,
Brian
 
reply
    Bookmark Topic Watch Topic
  • New Topic