• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet Response Help

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 391
1
MySQL Database PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

reply
    Bookmark Topic Watch Topic
  • New Topic