Hey!
Yes, I recommend you use POST for HTML forms. I GET when using applets,
and therefore don't run into your problem.
Sans adieu,
Danny Rubis
Tom John wrote:
> Hi,
> I will try with doPost and let U know whether it works for doPost, But let
> me explain what my Problem was
>
> in my html form it asks the user to input data (client side), it looks like
> this
>
> ...
> ...
> <BODY><FORM METHOD=GET ACTION='/handle'>
> ...
> ...
>
> and in the servlet it is as follows
>
> ....
> ....
> public void doGet(HttpServletRequest req,HttpServletResponse res)
> throws ServletException,IOException{
> ....
> ....
> //(inserting to the db stuff is done here)
> ...
> out.println("Updated Succefully");
>
> //--------END----------
> Because the fact that I use doGet the query String will be appended to the
> URL. Though the client sees the above last sentence that is "Updated
> Successfully", by any chance if he tries to minimize the page(the html page
> which gives the message "Updated Succesfully") or do something else other
> than closing, it tries to again connect to the server with the above
> appended query String(because am using doGet) hence it gives a SQl
> Exception. That is because it tries to insert the same record,
>
> Hope this is clear now, Also let me know whether this problem can be avoided
> if use doPost rather than doGet
>
> Tom
>
> At 07:23 PM 1/10/98 -0500, you wrote:
> >Hey!
> >
> >I, and maybe others, am having trouble understanding your difficulty.
> >
> >If you write a servlet that overrides doGet() that sends back to the browser an
> >HTML forms page constructed with entry fields, check boxes, radio buttons,
> >and etc., then when the user makes selections and inputs data, the submitted
> >form POSTs
> >the parameters to the servlet .
> >
> >Then override the doPost() with whatever message that you want to send
> >back after inserting to the DB.
> >
> >If I have guessed wrong, please give us more details about your implementation.
> >
> >What event triggers the doGet()? A POST will never post itself again with
> >minimizing.
> >It may ask you if you want to rePost the data.
> >
> >Sans adieu,
> >Danny Rubis
> >
> >Tom John wrote:
> >
> >> Hi,
> >> I do have a servlet which connects to a database and insert data to the
> >> database and send results as HTML page, In this servlet I do use doGet
> >> method ,The servlet works properly, but the problem is when try to see the
> >> source of the page or if we minimize the page it again try to reconnect,
> >> because of this
> >> reason it gives an SQLException : General Error that is trying to re insert
> >> the same data to the Db, (keep in mind that this is a Client Server Project)
> >> can anybody let me know how to overcome this problem.
> >>
> >> Tom
> >>
> >> ___________________________________________________________________________
> >> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> >> of the message "signoff SERVLET-INTEREST".
> >>
> >> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> >> Resources: http://java.sun.com/products/servlet/external-resources.html
> >> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
> >___________________________________________________________________________
> >To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> >of the message "signoff SERVLET-INTEREST".
> >
> >Archives: http://archives.java.sun.com/archives/servlet-interest.html
> >Resources: http://java.sun.com/products/servlet/external-resources.html
> >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
> >
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html