• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invoke servlet from java class

 
Sathish Ramadas
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How do you invoke a servlet from a simple java class.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sathish,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at HttpURLConnection and URL classes. They're what you want (you may also want Runnable and Thread to avoid long waits in your program while the network connection is open).
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that servlets are intended to run in the servlet container environment such as Tomcat, not as stand-alone programs. It is the servlet container that handles turning your HttpURLConnection into a request.
Bill
 
Sathish Ramadas
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the information.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic