Wednesday, January 2, 2008

Eureka... Eureka... got the soln !! Ajax validations now happen!

Finally the problem melted down.. i am now able to validate the form by ajax, field level with out the page refresh. Thanks to 'Vita Rara' -the info was vital in achieving this.

Some how i strongly feel error in js files (jira). So the steps go as follows:
  1. created a new theme cajax (custom ajax) 'Vita Rara'
    1. create a directory template/cajax in ur java source (src/)
    2. explode struts-core.jar and...
    3. copy the struts2-core-2.0.9\template\ajax\* into cajax folder. For struts 2.0.9 there are abt 21 files
    4. go to the jsp and in context create a folders scripts, scripts/ajax, scripts/xhtml in it. The idea is that the url: http://site:8080/context/scripts should show the script files.
    5. copy the validation.js (s) from struts2-core-2.0.9\template\xhtml and struts2-core-2.0.9\template\ajax into the into
    6. copy clientValidation.js from struts2-core-2.0.9\org\apache\struts2\static\ to scripts folder of step 3
    7. This completes the basic infrastructure required to get things.
  2. register the theme (prop file)
changes to be done in the js files:

  1. Mainly we need to provide checkbox handling in the js
  2. modify the form.ftl etc ftls to take this js instead of the once in the struts-core.jar



No comments:

Post a Comment