• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

calling servlet from jquery

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a simple code in jsp file which is not hitting the servlet. Can I know what is wrong in the below code?

JSP file:-



Servlet file:-

 
author & internet detective
Posts: 40207
816
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Archana,
Welcome to CodeRanch! I added [ code ] tags to make the post easier to read.

Can you try a few debugging things?
1) Look at the JavaScript console in your browser to see if there are any JavaScript errors?
2) Add alert("here"); before var P="123"; to see if it is even entering your jQuery code.
3) Look at the server log to see if there is a Servlet configuration error.
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also look at the Network pane of the browser's debugger. it'll show you if the call is even being made.

Your URLs shouldn't be absolute. They should be server-relative, starting with the context path of the servlet. See the ServletsFaq foe more info on URL paths.
 
Archana Jain
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply. I got it resolved. It was Allow-Origin Problem
 
Hang a left on main. Then read this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic