Forums Register Login

This servlet code is executed but cannot insert data into database .Iam using oracle database

+Pie Number of slices to send: Send
1
+Pie Number of slices to send: Send


This isn't the right way to compare whether two String objects have the same contents. Use the equals() method of String to do that:



If you do some basic debugging I think you'll find that none of your JDBC code is ever executed.

1
+Pie Number of slices to send: Send
Apart from the HTML outputting inside the servlet, I see three major issues, where the third one is the probable cause of your direct issue:
1) You shouldn't ignore the exception in the init method. At least print it, so it will be present in the logs. Or just wrap it in a ServletException so the servlet will fail to initialize.
2) Your code is prone to SQL injection. Use a PreparedStatement instead.
3) Don't compare Strings using == but use the equals method instead. You're comparing for instance equality, and it's very unlikely that the parameter value is exactly the same object.
+Pie Number of slices to send: Send
can i knw how to execute multiple queries using single connection?
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1603 times.
Similar Threads
update of records
Absolute Position in IE
stylesheet effect are not showing in jsp page
Trouble with "@" and spaces in mySQL
Help ME PLZ. Very Soon..
Why should you try IntelliJ IDEA ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:27:21.