This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

unable to send an email and update Database at a time  RSS feed

 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've the below code in my servlet for updating database.




and the below for sending E-Mail





these servlets are working fine when i use them separately, but when i use them combined by putting the first one in post and the second one in get methods it is giving me output as "Err"(the one i defined for updating the data).

could you please help me how do i get these things work.

the jsp i used is as below.

 
Sheriff
Posts: 23706
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The <form> element in your HTML sends a request to the server. That's "a" request -- one single request. This request should be directed to a servlet which validates and handles the form parameters, not to a JSP.

If the <form> element has type="post" then the doPost() method of the servlet will be called, and if it has type="get" then the doGet() method will be called. Your design should choose the type parameter appropriately.

So that means that the servlet which the <form> element requests should have code in either doPost() or doGet() to handle the request, but not in both of them.
 
Rakesh Keerthi
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,
thanks for the suggestion, based on it i've updated the code as below but now i'm getting some other error.

Jsp is:




The servlet is as below.




web.xml:





when i run this program i'm getting the below error.



Also could you please suggest me how to see how the servlet workflow goes. I use Netbeans IDE.
Thanks
 
Author and ninkuma
Marshal
Posts: 66806
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rakesh Keerthi wrote:based on it i've updated the code as below but now i'm getting some other error.


Keeping the nature of the error a secret is not a good way to get help on it.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!