Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

can't an applet connect to two different servlets?

Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can 't I have two HttpURLConnections in the same applet? I have this code:
private HttpURLConnection con;
private HttpURLConnection con2;
public void init() {
con = abreConexao("http://localhost:8080/hardkey/checar?checa=true";);
con2 = abreConexao("http://localhost:8080/hardkeydevolver?test=true";);
ObjectInputStream inputFromServlet = new ObjectInputStream(con.getInputStream());
ObjectInputStream inputFromServlet2 = new ObjectInputStream(con2.getInputStream());
catch(IOException e){
All the method abreConexao() does is open an connection to the url I send to it.
In the servlets all I have is a println in the doGet method. Why I can see the output from the first servlet but not from the second??
I'm stuck in this for days, please help.
Posts: 9612
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by kelly goedert:

Your URL's servlet paths are different. I think you are missing a forward slash in "hardkeydevolver"
You can thank my dental hygienist for my untimely aliveness. So tiny:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic