Odd problem with doGet/doPost in same servlet

C

canoe414

Greetings all,

I've crafted a servlet named insert_stuff with both doGet and doPost
methods like so:


doGet( .....) {
......................build webpage containing a form named
insert_stuff
}

doPost(....) {
....................standard read-form-insert-fields-into-database code
....................doGet( request, response);
}

The first time the user goes to the webpage .../insert_stuff ie.
with no parameter doGet is executed and the page with the form is
built and displayed. Good so far.

Filling the form and clicking Submit causes doPost to be executed, the
data does get inserted into the database BUT the page and empty form
do not get rebuilt and displayed, as if the doGet called from within
doPost is commented out.

To further muddy the waters, the servlet works perfectly when the form-
handling code is commented out, as in an empty form in a newly-built
page is displayed .

Any ideas/suggestions/pointers to code snippets are all appreciated.

TIA,

Steve
 
C

canoe414

The problem turned out to be a statement left over from modifying the
database code from a query to an add/change/delete
doPost(....) {
...................standard read-form-insert-fields-into-database code
...................rs.close(); /*remove this line and all works fine */
...................doGet( request, response);

}

Works like a charm now!

Thanks anyway,

Steve
 
C

Chris ( Val )

The problem turned out to be a statement left over from modifying the
database code from a query to an add/change/delete



Works like a charm now!

I'm glad you sorted it out, but based on the information
you previously posted, how did you expect anyone to know
the answer in the first place?

This post even includes some code (apparently the
offending piece), that wasn't in your original post.

:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top