This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes Nested Tag (in Form of Table ) :: not able to submit  masterForm Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Nested Tag (in Form of Table ) :: not able to submit  masterForm" Watch "Nested Tag (in Form of Table ) :: not able to submit  masterForm" New topic
Author

Nested Tag (in Form of Table ) :: not able to submit masterForm

poonam mehta
Greenhorn

Joined: Jul 17, 2007
Posts: 4
hi,

I'm facing Error IndexOutOfBoundsException... while submitting form...

few details regarding my code :


[1]


==>>[2]



==>>[3] in JSP, I added ItemDetails in Form of table




== Struts.xml



==>> in ActionClass



==>> Error Occurs



java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at org.apache.commons.beanutils.PropertyUtilsBean.get IndexedProperty(PropertyUtilsBean.java:433)
at org.apache.commons.beanutils.PropertyUtilsBean.get IndexedProperty(PropertyUtilsBean.java:340)
at org.apache.commons.beanutils.PropertyUtilsBean.get NestedProperty(PropertyUtilsBean.java:684)
at org.apache.commons.beanutils.PropertyUtilsBean.get Property(PropertyUtilsBean.java:715)
at org.apache.commons.beanutils.BeanUtilsBean.setProp erty(BeanUtilsBean.java:884)


Pl. help in.

Let me know if you required any other information.

Thanks in Advance.
Venkata Kumar
Ranch Hand

Joined: Apr 16, 2008
Posts: 110

Please use code tags to post your code.

Please post your corresponding struts.xml contents and jsp contents.


SCJP 5.0, SCWCD 5, preparing for SCDJWS
poonam mehta
Greenhorn

Joined: Jul 17, 2007
Posts: 4
Hi,

I did changes in my original post as per your comments.

Pl. have a look into.

Thanks in Advance.

Byeeee
Venkata Kumar
Ranch Hand

Joined: Apr 16, 2008
Posts: 110

The action GRNAction scope is request. When the jsp is rendered the contents of arraylist are displayed. But when you submit the form the arraylist is reinitialized and becomes empty. To fix the issue you may change scope to session.
For more info see here



poonam mehta
Greenhorn

Joined: Jul 17, 2007
Posts: 4
Hello Sir,

As per your suggestion, I change the scope to request.--> session. and it works fine.

But still facing a problem :

By clicking on ADD button, it only take 1-ROW of the Item Table. Not taking rest of the rows which I add dynamically.

For adding a Row dynamically, I used below script :



Thanks for suggesting such informative link. As I'm new to struts, can you pl. suggest such links/books, which helps to understand struts-hibernate in depth.

Thanks in Advance.
Venkata Kumar
Ranch Hand

Joined: Apr 16, 2008
Posts: 110

Please post complete jsp file contents which may be useful to analyze the issue.
poonam mehta
Greenhorn

Joined: Jul 17, 2007
Posts: 4
Sorry for being delay in reply.

JSP Page :::

 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Nested Tag (in Form of Table ) :: not able to submit masterForm
 
Similar Threads
Exception creating bean of class web.struts.form.CompanyRegistrationForm
Struts & Hibernate Integration unable to delete values from MYSQL database
Struts: No getter method for property name problem
form bean is not getting updated upon submit in jsp
Struts- Error while java.lang.IllegalArgumentException: setAttribute: name parameter cannot be null.