One other way that I've done this (for more complex Javascript data
structures) is to use the JSON libraries with a JSTL function. It's
nice and general.
Create a JSTL function object like this:
public static final String json(String key, Object value) {
JSONObject json = new JSONObject();
json.put(key, value);
return json.toString();
}
tld:
<function>
<name>json</name>
<function-class>com.evernote.web.tag.EFunctions</function-class>
<function-signature>
boolean json(java.lang.String, java.lang.Object)
</function-signature>
</function>
and then in the JSP:
var gSearch = ${e:json('search',actionBean.search)}.search;
On Mar 20, 2009, at 11:17 AM, AK wrote:
AK <ama-l...@...> writes:
On IRC, Aaron helped clean this up for me:
onclick="cal17.select(document.forms[0].elements["item.dateFound"],
^^^^^^^^
'anchor17','MM/dd/yyyy');return false;"
The other thing that was suggested is not using document.forms[0]
since this
onclick would not work if another form was added to the top of this
one. As
such, I added an 'id' to my form:
<s:form beanclass="...action.AddItemFormActionBean" id="AddItemForm">
And then reference that within the onclick:
<s:text name="item.dateFound" id="item_dateFound" class="required" />
onclick
="calPop.select(document.getElementById('AddItemForm').elements
['item.dateFound'],'anchor_item_dateFound','MMM dd, yyyy'); return
false;"
A futher follow-up:
Rather than having an ID on the form, I'm just putting an id into
the s:text
element:
<s:text name="item.date" id="item-date" class="required" />
And then just referencing the element via the id:
onclick="calPop.select(document.getElementById('item-date'),
'anchor_item_dateFound','MMM dd, yyyy'); return false;"
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM)
are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly
and
easily build your RIAs with Flex Builder, the Eclipse(TM)based
development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users