• 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

servlets or just jsp custom tags

 
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was reading a post here:
http://www.caucho.com/quercus/faq/question.xtp?question_id=9
In general, people are arguing that when there is user input or other interaction involved, it's best to let the servlet handle that and then pass on to a JSP for the response. That makes sense to me. However, one guy said that he has found JSP custom tags adept at handling the input and so doesn't need servlets to clean that up. Personally, I have been writing a lot of JSPs but still don't know much about custom tags, so I'm wondering if any of you have the same opinion, or if I should definitely just use servlets for that stuff.
Thanks for any helpful opinions...
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I make heavy use of servlets for any processing and also heavy use of custom tags to help format the view. I seldom use custom tags to replace processing; I still see them as part of the "view".
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear, I like your responses (your experience has affected my decisions numerous times!). I'm wondering what you think about this guy's design for creating reusable input validation custom tags:
http://www.developer.com/java/web/print.php/3287891
Apparently, his argument is that this is a good approach just because you can update the tags or reuse the tags in numerous pages and you always have the validation taken care of (whereas in a servlet you would have to rewrite every time you had a servlet validating a zip code or something like that).
Is he correct? Or can you achieve the same thing with servlets, and in as just a reusable manner?
Also, this guy has his own style for trying to use JSPs and JavaBeans, which suggests it's better than using servlets for validation:
http://www.javaworld.com/javaworld/jw-03-2000/jw-0331-ssj-forms.html
Are these guys just smoking something?
Thanks for any more opinions...
[ February 16, 2004: Message edited by: S. C. Huey ]
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My 2 cents on the validation issue:
I don't agree at all that such trivial validation as input validation should be processed by the server, Custom Tag or Servlets. That type of validation should always be done on the client side with Javascript. I don't care how fast servers have become. That speed should be utalized for REAL server side work. Not bogged down because some idiot can't type in a SSN correctly.
Javascript can be updated just as easily as Custom Tags if not easier. I agree with Bear that Custom Tags should be used for View purposes. Not for processing. And on top of that, not for validation.
But that is just my opinion. Bear has much more experience at this stuff than I do, so I would definatly recommend considering whatever he says.
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe a strong reason for avoiding relying on Javascript is simply that it can be turned off. That opens the door to some extra security headaches if I'm not mistaken...
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

(whereas in a servlet you would have to rewrite every time you had a servlet validating a zip code or something like that).


I didn't have the time to go look at the link (sorry), but to the above all I have to say is that it's just as easy -- far easier, in fact -- to create re-usable Java components as it is to create re-usable tags.
With regards to where to perform validation, I have to disagree with Gregg on this one (rare). Since it's so easy for users to turn off client-side Javascript, or to just type in URL's, or to spoof their own forms that submit to your server (detectable), I never rely upon client-side validation and always perform validation on the server side upon submittal. That's not to say that I don't do client-side validation: I do when it will make the "user experience" better. I just never assume that any client-side validation has taken place.
 
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic