Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

Odd problem with doGet/doPost in same servlet

Thread view: 
canoe414@telecom-digest.zzn.com - 12 Nov 2007 21:53 GMT
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
canoe414@telecom-digest.zzn.com - 13 Nov 2007 11:10 GMT
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
Chris ( Val ) - 13 Nov 2007 12:35 GMT
On Nov 13, 10:10 pm, canoe...@telecom-digest.zzn.com wrote:
> The problem turned out to be a statement left over from modifying the
> database code from a query to an add/change/delete
[quoted text clipped - 7 lines]
>
> 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.

:-)

--
Chris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.