AJAX Tutorial - JSP call to Java Servlet using jQuery & JSON response

Philip Starritt · 94K views · 2013 · 20:52

Open on YouTube

Web developmentSoftware (other)tutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering beginners who are confused about how a JSP page, jQuery and a servlet fit together in an AJAX request.

Recommended by 1 people across 1 different months, 2013 to 2015.

What it is

A 2013 screencast walking through how to call a Java Servlet from a JSP page using jQuery AJAX and read a JSON response, with a Google Gson example. The presenter, Philip Starritt, builds it in an Eclipse-style project and notes that a framework like Spring REST or JAX-RS is a better choice than a raw servlet.

What people said

Recommends Adrian Stamin · 2013-10 · Stack Overflow · on “Refreshing javascript after jquery ajax call in jsp page”

You are doing an AJAX request every 5 seconds. The url seems to me to not be right. In JSP, you either make an AJAX request to a servlet, to a JSP page, or to some other resource. I don't know what .do is. Check out BalusC explanation here link [LINK] You do not fully grasp what and how AJAX works. You should learn more about this. Here is a video tutorial [this video]

Cites newbie · 2013-08 · Stack Overflow · on “Why AJAX doesn't work on my local”

I have been following an AJAX Tutorial [this video] and I did the same thing as he does but i don't why it doesn't work for me. Here's what i have done. index.jsp At the header i placed some source script <script src="../javascript/jquery-1.10.2.js"></script> <script src="../javascript/basic.js"></script> <link rel="stylesheet" href="css/basic.css" type="text/css" media="screen"> and at the body a simple snippnet is made <p class="large">Test AJAX</p> <form id="updateUsername"> <label for="username">What is your name?</label> <input type="text" name="username" id="username" /> <input type="submit" /> </form> <p id="displayName" /> basic.js Code for the ajax $(document).ready(function(){ $('#updat

Cites user3474126 · 2015-04 · Stack Overflow · on “Nothing being returned by simple jquery request through java serlvet”

i'll check. i tried to look earlier but that was another problem. thanks. I am looking at another solution : does my basic.js file have to be in a particular location/directory? in the tutorial he has his in a WebContent folder, it looks like a special generated folder? mine is just in a random package folder. [this video] . i do not have a WebContent folder