Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet not executing.

 
Javedali Shaikh
Greenhorn
Posts: 12
Chrome Eclipse IDE Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi All I am developing one application using jsp and servlets. In one jsp form i have used 3 forms and on click of each i am calling different servlets. When I am clicking on the submit button for 1 servlet the values are supposed to store in database, but it is not happening so. I don't know what is the actuall problem, I checked the code 4-5 times both servlet and deployment descriptor one, but could not locate the problem. It is not even generating even a single event. The entire console is blank. May i get anyone's help here? The code for servlet, jsp and web.xml is given below. Please help any help will be appreciated. Your help can help me in completing the project and deliver it to the client.

code for jsp


I am talking about form named "frmVoucherDetails". The other forms data i have manipulated for confidentiality.

Code for servlets.


Code deployment descriptor


Please help.
 
suraj aryan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why are you using ../VProcess etc in your jsp .It is not picking the proper url thats why your request is not reaching .
 
Javedali Shaikh
Greenhorn
Posts: 12
Chrome Eclipse IDE Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Suraj
Thanks for replying. Let me tell you one thing even after replacing "../VProcess" with simply "/VProcess", it is not working. I tried that prior to posting this topic. Can you help further?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The proper format for a URL is /contextPath/servletPath.

The context path is obtained from the request. The servlet path is mapped in the deployment descriptor. The <c:url> tag can help format the URL properly in a JSP.
 
Sujata Samal
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Javedali - As Bear suggested you can use the conextpath - hardcoded or get from request (<%=request.getContextPath()>) and you can put some SOPs/log statements inside doPost() to verify if the request is really hitting the servlet or not

-Sujata
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Except that you should not use scriptlets to get the context path.

Join the rest of us in the 21st century and be sure to use the EL and JSTL.
 
Sujata Samal
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm you are right..i was trying to give an example.
By the way JSF , Flex and many advanced UI technologies are already in 21st century market.

-Sujata
 
Javedali Shaikh
Greenhorn
Posts: 12
Chrome Eclipse IDE Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear and Sujata.
I am highly thankful to both of you for helping me with your replies. My only problem with this is that when I am able to run other servlets like this then, whats wrong in this servlet only? Bear you are right that these technologies are almost obsolete nowadays and we must work with these 21st century technologies as you mentioned. But I am totally helpless because I am not comfortable with these technologies, and my client has nothing to do with the technologies but early delivery. I would be thankful to you if you can help more further.

 
Sujata Samal
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javedali - I have a feeling that the js file has to be included with contextPath/script/voucherDtls.js as i could see the onClick() calls a javascript method before submitting the form..you can verify by adding some alert messages inside the java script methods and on click of submit the alert messages are getting executed.

-Sujata.
 
Javedali Shaikh
Greenhorn
Posts: 12
Chrome Eclipse IDE Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sujata
You are right. But for FYI I want to tell you that the js file is working fine, the validations for all the fields are working fine except the servlet is not hitting. As per your instructions I have written SOP's in servlet's doPost() but the attempts are in vain. Let me try, my attempts are on. May get back if need help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic