File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
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://aspose.com/file-tools
 
subject: Nested Tag (in Form of Table ) :: not able to submit masterForm