• 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

JSF and Clint Side Coding

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

I have been using JavaScript heavily for user input and business rules validation. As JSF is server-side technology, would it be recommended to replace such clint side coding by JSF. Isn't it degrade performance and increase serverside load?

Thanks,
Sanjay
 
Author
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by sanjay kumar:
Hi,

I have been using JavaScript heavily for user input and business rules validation. As JSF is server-side technology, would it be recommended to replace such clint side coding by JSF. Isn't it degrade performance and increase serverside load?

Thanks,
Sanjay



I don't think the "JavaScript or not" question has a different answer for JSF than it has for any other server-side technlogy. If you move validation to the server, independent of which server-side technology you use, there will be a lot more round-trips, and a page refresh for each round-trip. If this is acceptable or not depends on your environment (e.g., LAN users vs. Internet users), and possibly other factors.

JavaScript for some things, like early validation, is often a good idea for making the application easier to use and more responsive. Because of the differences in JavaScript versions between browsers, it can be time consuming to develop and maintain, though, unless you can control the browser choice of all users. But even if you do validation with JavaScript, you must also do it on the server, since the user can easily disable JavaScript in the browser.

Real business logic in JavaScript, on the other hand, is something I don't like. First, it means that the application work only if JavaScript is enabled in the browser. Second, it makes it mcuh harder to write automated tests for the application. These may or may not be serious issues for a specific application.

I prefer using JavaScript to add value for browsers with JavaScript enabled, but in such a way that the application works even without it. Custom JSF components can generate JavaScript code (for instance for validation) in addition to the markup, making it fairly easy to develop an application that combine client-side and server-side logic like this.
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks hans for this elaboration. I just tried to write exactly the same in another thread, since i had the experience of a customer wanting javascript turned off.
thankfully your reply more elaborate than mine, but then again i havent written a book.
 
reply
    Bookmark Topic Watch Topic
  • New Topic