Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue in submitting the Form with Arraylist in Struts 1.1

 
Kiran Chintha
Greenhorn
Posts: 15
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using Struts 1.1 for my application.
I have a list of text boxes in my Jsp Page. While pulling the data from the database, i am able to display the required data in the textboxes. But, when i update data in the text boxes and submit the page, the updated data is not available in the action class, nor even updating the data in the database. I have tried to print the data from each text box after updating it and submitting the page, but the old data is only printed from the textboxes. Why the updated data in the jsp page is not set in the Form bean. Am I missing something in this flow, which is causing this issue, Kindly help me out, i am trying to resolve this issue since yesterday, but of no use till now.

Thanks in Advance.
Kiran
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you trying to access the value of the textboxes in your action class, do you have a form bean with attributes that match the textboxes names or so?
 
Kiran Chintha
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, i do have the form bean with attributes matching the textbox names, but eventhough the changed values are not getting updated.
 
Kiran Chintha
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Overall, i have three arraylists and each arraylist have multiple text fields (i.e., a text field for each element in JSP).
I have a model class, in which there are setters and getters for each element in the JSP.
And for each arraylist I have setters and getters in the form bean class.
 
vipul bondugula
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kiran,
Please keep System.out.prinln("") statements in your form bean constructor and your setter methods..By this you will come to know whether data is populating for form bean or not..
 
Rajagopal Mani
Ranch Hand
Posts: 84
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please share all the related files including struts-config.xml?
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Corresponding to a textfield in the HTML FORM you should be having a String in your Form Bean. No matter what logic you use to populate the textfields initially Struts would look for a String member in your FormBean to store the field value on form submission.

Do post your struts-config.xml.

Cheers,
Raj.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic