Hi,
I recently upgraded struts from 2.0.11 to 2.1.6 for our App. Almost
everything works. But I recently got a nullPointerException on the select
tag though it was working fine for 2.0.11. "children" is a list and I am
trying to set name and age for each element in the children list.
In the following code s:textfield tag works fine but the s:select tag throws
a nullpointer exception.
<s:iterator status="stat" value="children" var="child">
<s:textfield name="children[%{#stat.index}].name"/> ///////
children[%{#stat.index}] works great here
<s:select name="children[%{#stat.index}].beginAge"
value="children[#stat.index].beginAge.id" emptyOption="true"
list="ageRanges" listKey="id" listValue="name"/> ////////
children[%{#stat.index}].beginAge throws null pointer
</td>
</s:iterator>
And the exception is :
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at
com.opensymphony.xwork2.ognl.OgnlValueStack.checkForInvalidProperties(OgnlValueStack.java:298)
at
com.opensymphony.xwork2.ognl.OgnlValueStack.findValue(OgnlValueStack.java:237)
at
org.apache.struts2.components.Component.findValue(Component.java:248)
at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:773)
at org.apache.struts2.components.UIBean.end(UIBean.java:510)
at
org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
at
org.apache.jsp.WEB_002dINF.pages.app.individualChildcareExperience_jsp._jspx_meth_s_005fselect_005f0(individualChildcareExperience_jsp.java:1257)
at
org.apache.jsp.WEB_002dINF.pages.app.individualChildcareExperience_jsp._jspx_meth_s_005fiterator_005f0(individualChildcareExperience_jsp.java:962)
at
org.apache.jsp.WEB_002dINF.pages.app.individualChildcareExperience_jsp._jspx_meth_s_005fform_005f0(individualChildcareExperience_jsp.java:315)
at
org.apache.jsp.WEB_002dINF.pages.app.individualChildcareExperience_jsp._jspService(individualChildcareExperience_jsp.java:132)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
If I change children[#stat.index].beginAge.id to
children(#stat.index).beginAge.id the page loads fine .
it renders it as children(0).beginAge.id and obviously it didn't set the
selected value. :(
Its clearly seen that select tag doesn't like "[ ]" anymore.
Anybody has any clue about what I am missing here. Or what would be the
workaround??
Thanks,
Anand.
--
View this message in context:
http://www.nabble.com/Nullpointerexception-s%3Aselect-tag-on-name%3D%22alist--status.index-.something%22-tp25530928p25530928.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]