• 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

Validtaiond, Struts, and html:javascript tag help

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to add validation to an existing struts 1.1 program. When I insert the <html:javascript> tag, the webpage outputs the validator-rules.xml javascript on the page as text, which causes my validation not to work. what am I missing, or what have I done wrong to cause this tag to change the validator-rules.xml to text on the screen?
 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you post the part of the code where the <html:javascript> tag is used. Is your form bean name correctly specified

Sheldon Fernandes
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way, could you also tell me the actual usage of <html:javascript>?

It will generate the Java Script, or it notices Struts engine to check the values in the form again some validation configuration file?

Nick
 
Sheldon Fernandes
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The validation rules, for fields of a form, written in validation.xml are executed server-side. These can also be executed client-side (javascript) by using the <html:javascript> tag. Note however that, most pre-defined validators provide javascript validation, but not all. You can check the validator definitions in validator-rules.xml to determine if a validator provides javascript validation. You will notice the javascript code written in the file, or you might find a reference to a .js file.

The <html:javascript> tag renders some javascript code on your page, all you have to do is make a call to a generated javascript method to initiate javascript validation.

Hope that answers you question, Nicholas
 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It may happen if you use html:javascript tag more than once in your JSP!
 
Oh the stink of it! Smell my tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic