Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

how to post data from applet to servlet.

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to set up a simple mail server, when some one sign up i want a servlet to be invoked which give the form for a new user and when he log's in the mail box should open. but my confusion is how on the press of a button (ie and applet button)
while i perform this task. please me with this query. thanks .
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at using the URLConnection classes. You will need these to post your data. You may want to try using JHTTP 1.1 at http://www.jscape.com Handles most all HTTP related functionality.

------------------
JFind - Your Java Resource www.jfind.com
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Inside the Applet, u instantiate a URL object by passing the url of the servlet which is going to handle the request as a parameter. Invoke a method called open request on the URL object which would give u URLConnection Object. Using connection object, get input & output streams and then write into the stream the datas which u want to pass to the servlet.
I would give u the code (frame work)
URL url = new URL("servlet url");
URLConnection con = url.openConnection();
OutputStream out = con.getOutputStream();
out.write("date to be sent");
Does this clears ur doubt?
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Applet to servlet communication is a great way (and more pure Java) to reproduce 2 components of the model-view-controller.
Take a look at the following article for a good overview, with code, on how to do it.
I won't repeat it by writing any more here!
http://www.j-nine.com/pubs/applet2servlet/Applet2Servlet.html
Good luck
T
 
reply
    Bookmark Topic Watch Topic
  • New Topic