JSP delima --- can not use JavaBean/Servlet

Hi, experts

I am in a delima here. I have to developed something solely JSP without any java classes (Servelt/JavaBean) because the stupid development evnironment I am in right now. No access to server, any class/jar deploy /test will take years....

Anyway, my task is I have to bring back from oracle DB up to 100 rows of data and force user give a setting for the last field of each row and click a submit to do a batch update to the table.

Each row can be identified by a composit key of several fields.

How can I do this. the best way I can figure out is through (preparedStatement and do a addbatch ) in a loop on the action page, then do a executeUpdate().

If I am right on the above. How can I pass the data to the action page? I am thinking I can somehow prepare a serializable Collection object with the resultset data on the first web page and pass it to the action page....

Please let me know your precious idea. just forget about my stupid thought as the above...


Thanks.....................
ca_rolandAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ca_rolandAuthor Commented:
Sorry, I should have said :


>>if I am right on the above. How can I pass the data to the action page? I am thinking I can somehow prepare a >>serializable Collection object with the resultset data on the first web page and pass it to the action page....


if I am right on the above. How can I pass the data to the action page? I am thinking I can somehow prepare a serializable Collection object "POPULATED BY" the resultset data on the first web page and pass it to the action page....
0
KuldeepchaturvediCommented:
Well, I do not think you wd be able to use Collections out here.. Because only way you can show data to User is a HTML page..
So you are bound to use table for this excercise...

Now assuming that user is suppose to update only the last field of the row data, I would use following approach..

While creating the table ( which will be a while loop for sure)... create a hiddenfield and call it (Key+count) here count is a counter thats icrementing with each row..
in the same row name the last field as (value+count)..
At the end of the table store the total rowcount in a hidden variable say ( rowcount)

now upon submit to action page this is how your processing will go..

create a prepared statement... which will look like..
stmt="update table lastfield=? where key=?";

String rowcount = request.getParameter('rowcount");
int count = new Integet(rowcount).intvalue();
for (int i=0; i<count;i++)
{
String key = request.getParameter("key"+i);
String value = request.getParameter("value"+i);
if(key!=null&&value!=null)
{
stmt.setString(key,1);
stmt.setString(value,2);
stmt.execute();
}
}

//end of the processign.

The code I have written above is just  the example, I have checked for the correctness of syntax..
Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.