You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Denis Wang <dw...@brandmuscle.com> on 2002/11/12 14:19:37 UTC
how to populate nested bean in actionform
Hello,
Suppose I have ActionForm aForm, which has a private field aBean. aBean is
a dumb data hold class with a field aData. I can populate the aData from my
backend data resources and write it to JSP as the following:
<nested:form action='the action related the aForm'>
<nested:nest property='aBean'>
<nested:write property='aData'>
...
My problem is how to read the aData from JSP and write it to my backend data
resources. I tried:
<nested:form action='the action related the aForm'>
<nested:nest property='aBean'>
<nested:text property='aData'>
...
The server will throw NullPointerException. I am afraid the struts don't
know how to initiate aBean before setProperty("aData").
Any help will be highly appreciated!
Denis
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: how to populate nested bean in actionform
Posted by Denis Wang <dw...@brandmuscle.com>.
It is interesting to notice the difference between
<%-- jsp comment --%>
and
<!-- html comment -->, which will not shadow tags defined on the serverside.
Have a great day!
Denis
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: how to populate nested bean in actionform
Posted by Denis Wang <dw...@brandmuscle.com>.
Thanks all for your kindly help and attention.
The NullPointerException is caused by something else. It turns out <!--
<nested:text property='illegalArgument'/> --> will not comment out the
"illegalArgument", which caused the exception.
It seems to me the struts will automatically take care of the initiation of
aForm and aBean.
Enjoy coding.
Denis
-----Original Message-----
From: Denis Wang [mailto:dwang@brandmuscle.com]
Sent: Tuesday, November 12, 2002 8:20 AM
To: struts
Subject: how to populate nested bean in actionform
Hello,
Suppose I have ActionForm aForm, which has a private field aBean. aBean is
a dumb data hold class with a field aData. I can populate the aData from my
backend data resources and write it to JSP as the following:
<nested:form action='the action related the aForm'>
<nested:nest property='aBean'>
<nested:write property='aData'>
...
My problem is how to read the aData from JSP and write it to my backend data
resources. I tried:
<nested:form action='the action related the aForm'>
<nested:nest property='aBean'>
<nested:text property='aData'>
...
The server will throw NullPointerException. I am afraid the struts don't
know how to initiate aBean before setProperty("aData").
Any help will be highly appreciated!
Denis
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>