You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anandkris <ni...@yahoo.com> on 2009/09/23 00:44:05 UTC
Nullpointerexception s:select tag on
name="alist[#status.index].something"
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Nullpointerexception s:select tag on
name="alist[#status.index].something"
Posted by Anandkris <ni...@yahoo.com>.
Hi Musachy,
Thanks for the reply. I debugged and just found that the select tag could
not render "children[i]" as a list element.As I mentioned before if I change
children[i] to children(i), just to try whats happening, the page loads
fine.
Since we work on Agile and had a deadline of an hr or so, I did a workaroud
by setting the children[i] as a hidden value from selectedIndex.
Hope this will be fixed in 2.1.8. :)
Good luck and Thanks again for the reply.
-Anand
Musachy Barroso wrote:
>
> can you debug it and see what is actually null? It seems like a bug.
> That being said, I am building 2.1.8 as we speak, so if you are
> planning to upgrade, it might be worth waiting a bit.
>
> musachy
>
> On Tue, Sep 22, 2009 at 3:44 PM, Anandkris <ni...@yahoo.com> wrote:
>> OgnlValueStack
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Nullpointerexception-s%3Aselect-tag-on-name%3D%22alist--status.index-.age%22-tp25530928p25617851.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Nullpointerexception s:select tag on name="alist[#status.index].something"
Posted by Musachy Barroso <mu...@gmail.com>.
can you debug it and see what is actually null? It seems like a bug.
That being said, I am building 2.1.8 as we speak, so if you are
planning to upgrade, it might be worth waiting a bit.
musachy
On Tue, Sep 22, 2009 at 3:44 PM, Anandkris <ni...@yahoo.com> wrote:
> OgnlValueStack
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org