struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ironic <iocon...@visa.com>
Subject Struts2: list and map indexing
Date Fri, 27 Jul 2007 22:17:17 GMT

Can anyone point me to a working example of Struts2 indexed properties? I've
managed to get list indexing working: 
&lt;s:checkbox name="users[%{#status.index}].administrator"... /&gt;
but haven't had any luck with the map style: 
&lt;s:checkbox name="filter[%{#state.name}]"... /&gt;
(where state.getName returns a String), or the property-indexing style: 
&lt;s:textfield name="beanList(%{#bean.id}).name" value="%{#bean.name}"/&gt;
 (as described in the  http://cwiki.apache.org/WW/type-conversion.html wiki
). I tried running something similar to the wiki example (see attached
code), but when I submit my form I see an exception thrown for every attempt
to set a property (see below). Any insight or pointers would be greatly
appreciated.

The top of the exception stack:

ERROR 17:31:23,510 [com.opensymphony.xwork2.util.XWorkMethodAccessor] - An
unexpected exception occurred
ognl.OgnlException: Error getting property descriptor: null
	at
com.opensymphony.xwork2.util.XWorkCollectionPropertyAccessor.getProperty(XWorkCollectionPropertyAccessor.java:92)
	at
com.opensymphony.xwork2.util.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:61)
	at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:846)
	at
com.opensymphony.xwork2.util.CompoundRootAccessor.callMethod(CompoundRootAccessor.java:196)
	at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:846)
	at ognl.ASTMethod.getValueBody(ASTMethod.java:73)
	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	at ognl.SimpleNode.getValue(SimpleNode.java:210)
	at ognl.ASTChain.setValueBody(ASTChain.java:168)
	at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
	at ognl.SimpleNode.setValue(SimpleNode.java:246)
	at ognl.Ognl.setValue(Ognl.java:476)
	at com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186)
... etc, etc

The relevant piece of my struts.xml file:

    &lt;action name="MyBean_show" method="show" class="MyBeanAction"&gt;
      &lt;result>/jsp/MyBean.jsp&lt;/result&gt;
    &lt;/action&gt;
    &lt;action name="MyBean" class="MyBeanAction"&gt;
      &lt;result type="chain"&gt;MyBean_show&lt;/result&gt;
    &lt;/action&gt;

Here's the bean (as per wiki):
http://www.nabble.com/file/p11837653/MyBean.java MyBean.java 

Here's the action code:
http://www.nabble.com/file/p11837653/MyBeanAction.java MyBeanAction.java 

And the conversion properties:
http://www.nabble.com/file/p11837653/MyBean-conversion.properties
MyBean-conversion.properties 
-- 
View this message in context: http://www.nabble.com/Struts2%3A-list-and-map-indexing-tf4160457.html#a11837653
Sent from the Struts - User mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message