aspose file tools*
The moose likes Servlets and the fly likes Servlet not executing. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet not executing. " Watch "Servlet not executing. " New topic
Author

Servlet not executing.

Javedali Shaikh
Greenhorn

Joined: Sep 13, 2008
Posts: 12


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

Joined: Nov 19, 2010
Posts: 17
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

Joined: Sep 13, 2008
Posts: 12

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

Joined: Jan 10, 2002
Posts: 61229
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sujata Samal
Greenhorn

Joined: Jan 29, 2008
Posts: 20
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

Joined: Jan 10, 2002
Posts: 61229
    
  66

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

Joined: Jan 29, 2008
Posts: 20
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

Joined: Sep 13, 2008
Posts: 12

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

Joined: Jan 29, 2008
Posts: 20
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

Joined: Sep 13, 2008
Posts: 12

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.
 
Don't get me started about those stupid light bulbs.
 
subject: Servlet not executing.