Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exact API for java stand-alone application talk to servlet

 
Ruilin Yang
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Please help me I would like to talk to a servlet from a java stand-alone application (richer graphic. What are exact API at both client side and the server side ?
Thanks
Ruilin Yang
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the client side you are looking at creating a URLConnection to the URL of a servlet, opening a stream, writing a request and reading a response stream. URLConnection is in the java.net package, part of the standard SDK library.
The alternative would be to open a socket, but URLConnection is simpler.
On the server side you are obviously talking about a class derived from HttpServlet. You can download Tomcat and get the API docs.
Bill
 
Ruilin Yang
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William,
Thanks
That is great help. Furthermore I would like to get some code snipets at client program and also in the servlet.
Thanks again
Ruilin
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this link
it has code on applet-servlet communication.
im sure ull be able to turn it into application applet.
 
Ruilin Yang
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roy,
Thanks
It is good code. It is the same for java application with applet.
Regards,
Ruilin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic