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

dynamicJavascript

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

i am very much confused between the dynamicJavascript and staticJavascript attributes of <html:javascript> tag.

Could some one please explain me what these attributes are meant for?
Why are the set to true by default?

what is the difference if we set the dynamicJavascript to false?


Please help me.

Thanks in advance.
 
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 validators (both pre-defined and user-defined) perform server-side validation. They may or may not provide client-side validation. If you look at the definitions of the pre-defined validators in validation-rules.xml you can identify if a validator provides client-side javascript validation or not.

STATIC
The javascript methods, present within the <javascript> element or in .js files, form the static content generated by <html:javascript>.

DYNAMIC
1. The <html:javascript> tag generates javascript objects for each pluggable validator, that are used by the static javascript method of that validator. These store the information about the fields and their validation as defined in the validation.xml. For example:

2. In addition it also generates the main javascript validation method which initiates the entire client-side validation.

You can turn each attribute's generation of JavaScript on and off by putting in true or false (they default to true).
Normally, dynamicJavascript is set to true so that is gets generated on the page and staticJavascript is set to false. The static javascript can be put in .js files to take advantage of browser caching.

I hope this makes sense. Have a look at the code generated by the <html:javascript>.

Sheldon Fernandes
[ October 10, 2004: Message edited by: Sheldon Fernandes ]
 
pavanasree vasireddy
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the reply. I got it clarified.


Can u please tell me the class name in which the code to generate dynamicJavascript is written?



Any help is appreciated.

Thanks in advance
 
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 tag handler class for <html:javascript> is
org.apache.struts.taglib.html.JavascriptValidatorTag

Sheldon Fernandes
 
It looks like it's time for me to write you a reality check! Or maybe a tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic