How to pass a value from java to javascript variable
I've a xml which contians a table details like field name,datatype and other details. By Parsing the xml file I am constructing a dynamic table and loading data from the data base which is working very fine.
But my intention is to pass these data structures (fieldname,datatype) to java script to do client side validataion.
For doing client side validation I need to get the xml parsed values here in java script how to handle this ?
[456 byte] By [
cscs42] at [2007-11-26 9:12:15]

# 2
There is one way to get data in a HTML Page for further processing with Javascript I figured out. I already asked here wether or nor there is a more elegant method but did not get any answer. But now my "trick":
Take your data and put it in a Java String. Create a setter and a getter for this Java String. Use a hidden Component and associate the Java String to the hidden Component text property.
In the rendered HTML page you can access this String with document.getElementById("your_hidden_element_id").value
and do whatever you like to do with it.
Do not forget to build a setter for the Java String! As the hidden components value will be written back by the JSF framework you'll get navigation problems and error messages if the setter is missing.
Hope this helps,
Juergen