Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet Response Help  RSS feed

 
Nikolas Verbinsky
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am new to this so please forgive me for my lack of understanding. I am working with google maps and I have a maps page that I want to populate with multiple markers. I have created a servlet that connects to a MYSQL DB and pulls out all of the information I need to generate the markers. Now how can I call this servlet from a HTML5/JSP page? I need to pass all of this info to an array so that I can loop through it and generate the pins. Right now I have been successful in pulling the data and writing to console in Netbeans IDE.



Now here is the thing. I have already done a version of this page in PHP where I echo through an XML file. I want to do the same thing but using a Java servlet. Here is my page

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Please be sure to UseCodeTags for code, not quote tags. Not sure why you did that for the second code segment.

I fixed it for you.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are already using Ajax in the page so I assume you know how to make requests using Ajax.

Also recommend using jQuery to vastly simplify your code.
 
Nikolas Verbinsky
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:You are already using Ajax in the page so I assume you know how to make requests using Ajax.

Also recommend using jQuery to vastly simplify your code.


Hi this code was assembled using the tutorial found here
and with sample code that I got from Maps API sample code. So I am not a 100% sure exactly how it works. I tried to follow another tutorial on how to import a JSON object but I was not successful. How would AJAX calls exactly work?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My advice: remove all code that you did not personally write. Examples are fine to look at, but copying them verbatim means you end up with code that's a mystery.

Start from the basics and add code that does what you want one step at a time. Do not proceed to the next step until the previous step is working and tested.
 
Mahtab Alam
Ranch Hand
Posts: 391
1
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Bear on using code taken from internet. I also do that while learning, a lot of times I used code taken from web .
And ultimately I have to change it , to make it as I want. I liked this advice


Start from the basics and add code that does what you want one step at a time. Do not proceed to the next step until the previous step is working and tested.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!