• 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

HTML page-tomcat servlet interaction

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. I'm new to using java servlets.


The model I'm trying to create looks like this


Front web page(not a part of webapp for within Tomcat; just a standalone HTML page) -> Java servlet(in Tomcat) -> Remote Machine(Do some work here)

then the response generated in remote machine is delivered back to the web page.


How do I "return" something back to the web page from servlet?



I created an Ajax request from a javascript attached to the web page, which is sending a GET request to the servlet. I want to have the servlet give back a String to the web page.


In PHP, I'd use the print() method.


Do I just use Printwriter.println()? Or Printwriter.write()?



Thanks in advance.
 
Ranch Hand
Posts: 312
MS IE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe, either of the two are ok (unless you are worried about efficiency).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic