• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Client side Javascript validation in JSF?

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a built-in support in JSF for client side Javascript validation (like Struts)?
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know about "built-in" support, but it is very easy to use javascript within JSF applications. Everything is the same as a usual JSP, however, you access your component values via the following syntax:

passedform["formname:componentid"].value

Hope this answers your question.

Josh Juneau
 
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also customize your components to render javascript.
 
Alok Pota
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By built-in support I mean by just adding a line like..

<html:javascript formName = "/Blah"
method = "validateForm"
dynamicJavascript = "true"
staticJavascript = "true"
page = "1"
cdata = "false"/>

in my JSP, the Javascript is automatically provided to me based on the validation rules I specify in the xml, without me having
to manipulate/extend/customize any out of the box functionality. (Struts)

From what it looks like JSF components do not generate the relevant Javascript out of the box.
 
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

Originally posted by Alok Pota:
By built-in support I mean by just adding a line like..

<html:javascript formName = "/Blah"
method = "validateForm"
dynamicJavascript = "true"
staticJavascript = "true"
page = "1"
cdata = "false"/>

in my JSP, the Javascript is automatically provided to me based on the validation rules I specify in the xml, without me having
to manipulate/extend/customize any out of the box functionality. (Struts)

From what it looks like JSF components do not generate the relevant Javascript out of the box.



Nope, they don't. Sun decided to leave that up to the implementation. They did not want that in the specification.
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at Shale ( http://wiki.apache.org/struts/StrutsShale ). Integration of Commons Validator for client and server-side validation support is already added there. So, you can use it in your JSF application similar to Struts.

--
Sergey : jsfTutorials.net
 
You learn how to close your eyes and tell yourself "this just isn't really happening to me." Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic