I've a HTML form say,Feedback.html.I need to retrieve values from it and store it in the database table.I ve got FeedbackServlet.java which shd be doing this.I am storing the values in the vector.
But the problem is,The order of columns changes for every Submit.So i can not store as is it in a table.What do i do??and How??
Shd I ve a 2 dimensional vector and get column names & values dynamically??(i tried this but failed)
Can nayone help me with this or suggest smthg better
its pretty simple don't go for vector..since the fields in the feedback form is defined(say 10 fields)..go for an array then store values from the field seperated by a delimiter | sign.you can use a string tokenizer to retrieve the values and store it in database and also you can store the values as per you sorting which will not give you the problem as you mentioned earlier in vector
all the best
Originally posted by P SOLAIAPPAN:
I donot understand what is
"The order of columns changes for every Submit."
If you give some more details with code, may I may able to help.
Hello, What I mean by this is..
Say ,I ve 9 fields in my form and have corresponding database columns in my Table Feedback_Master_T.Feedbackform has fields namely Username,Email,Fax,TEl,Comments etc.So when user clicks on submit ,the order in which the values shd get insert into the table is Username,email,Fax,Tel,Comments.
But this order is getting changed for EVERY SUBMit and so I am having problem inserting it into the database.In mytable I get name in Fax column and so on.
Is it clear now??
So I need to retrieve field names & values dynamically and accordingly write the insert statement
Will u be bale to help me now??
Originally posted by Frank Carver:
It is always good procedure to use the full form (with column names) of a SQL insert statement, so that which columns you are inserting are tied to the values. It is also good practice to extract servlet parameters by name too, so you should be able to avaoid this problem.
It did work properly.All my problems are solved