So when I'm submitting the form its throwing NullPointerException. Is it possible to create index property control with multiple nested beans ?
Is possible then how to do that ?
As I understood about index property and class nesting hierarchy, HTML code should generate like below -
<input type="text" name="bean.ddetails[0].deptid" >
<input type="text" name="bean.ddetails[0].deptname" >
<input type="text" name="bean.ddetails[0].deptloc" >
.....
.....
<input type="text" name="bean.edetails[0].empid" >
<input type="text" name="bean.edetails[0].empname" >
<input type="text" name="bean.edetails[0].emploc" >
So that after submit the form, beans are properly filled from respective text box values.
Ok, Need one information, are you submitting or displaying employee department data through this JSP ?
If you are submitting then post the code for html:action tag
And there is a good resource here regarding Indexed properties, you may be interested !!
Sorry ! I've not mentioned the <html:form> tag. My <html:form tag points to the "/employee/PromotionProcess" action.
First I'm showing a form where user enters employee and department data tabular wise, i.e. multiple record at a time can be entered. After submit I'll take those data in an action and store them in
database. But data is not coming after submit. BeanUtility simple fails to map the text box names with the beans properties.
Prithwish Ghosh wrote: But data is not coming after submit.
Firstly, I think, the struts bean extends ActionForm class, which I don't see in your bean/form class.
And
Have you checked out whether the data is getting stored into Bean, print out this data into your action class, like
Prithwish Ghosh
Greenhorn
Joined: Mar 04, 2009
Posts: 9
posted
0
Thanks Sagar for your help. I've searched out your given links and found some tricky things which gave me a different idea. I've changed my JSP page like below and my problem is solved -
Now this code generates HTML as I was looking for. Thanks to JavaRanch forum too.
Prithwish Ghosh wrote:Thanks Sagar for your help. I've searched out your given links and found some tricky things which gave me a different idea. I've changed my JSP page like below and my problem is solved -
I like your efforts, some people who joined JR just want ready code, but you searched and help yourself and that's the best thing of this forum, Its helps you to learn and engaged in some brainy discussion..
And you're welcome.
And lastly, you can avoid those scriptlet
and try some Els
Prithwish Ghosh
Greenhorn
Joined: Mar 04, 2009
Posts: 9
posted
0
Actually I was not confident about EL. After your suggestion I've looked for EL tutorials and now using EL in my code like this -