<nerderg:asJSArray var="options" items='["opt1", "opt2", "opt3"]'/>
The above tag generates a javascript tag that makes a javascript array of the given object. So the above would generate something like this:
This tag basically encodes any object as JSON, so you can do this too:
<nerderg:asJSArray var='command' items='${command}'/>
and you'll end up with something like this:
<script type='text/javascript'>
options = ["opt1","opt2","opt3"];
</script>
This tag basically encodes any object as JSON, so you can do this too:
<nerderg:asJSArray var='command' items='${command}'/>
and you'll end up with something like this:
<script type='text/javascript'>
command = {"class":"com.nerderg.taglib.FauxCommand","date":null,"options":"[opt1, opt2]","value":"hello world"};
</script>
command = {"class":"com.nerderg.taglib.FauxCommand","date":null,"options":"[opt1, opt2]","value":"hello world"};
</script>