I am developing struts 2 application using oracle 1og database.
I have a form with 4 rows of data.
when I am inserting data then all the data is inserting in same row with 'commas' in database inplace of saving in different rows. How to resolve it...
Thanks in advance...
getter and setter class....
Second, when you say:
all the data is inserting in same row with 'commas' in database inplace of saving in different rows
are you saying one field gets all the values for a particular row or you are only getting one row inserted when you expect 4?
Finally, If you have 4 rows in your form, you have to configure your form and action so Struts knows there are multiple rows and has someplace to put them. Since you only have one bpv_insert_data in your action, I assume you have not done this. Start with this example (again, Struts 1, but the principles still apply). By the way, you don't have to create an instance of bpv_insert_data. Struts will do that automatically.
and thanks for reply and please do reply...
Karthik Jayachandran wrote:If you are using an IDE, try creating breakpoints and debug the code line by line to identify the exact problem.
I don't think a debugger would help solve the design problem we are facing here.
@Saumitra: If you need a Struts 2-specific example, there are many on the 'net. Just search for "struts 2 indexed properties"
Saumitra Tiwari wrote:I want values in different rows....
I'm still not quite grasping the problem. I think you have two issues:
1. You are submitting a form with 4 rows of data but the application is only creating one row in the database. If this is true, my first post in this topic has a link to the solution for that: indexed properties.
2. Each column in the row in the database contains all the values separated by commas. The way I understand SQL INSERT is that you can specify the column values in the VALUES statement and you don't have to specify the column names, so your SQL statement appears to be correct. I have the following questions:
2.1. Have you tried executing the statement in SQL Plus or some other SQL console?
2.2. Have you tried specifying the column names in the SQL query?
2.3. Why are you calling ps.cancel()? That aborts whatever command is being executed, so at the least, it does nothing (coming after the con.commit()). At worst, it is rolling back whatever work you have done.