aspose file tools*
The moose likes Applets and the fly likes Hit A Servlet From an Applet with values in the URL for the Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Hit A Servlet From an Applet with values in the URL for the Servlet" Watch "Hit A Servlet From an Applet with values in the URL for the Servlet" New topic
Author

Hit A Servlet From an Applet with values in the URL for the Servlet

sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

Hi Folks,

I have a simple Applet that takes values from the fields and will hit the servlet with those values.

The URL is http://ip:9001/timelog/CollectData?name="+name+"&status="+status;

where the context root is timelog and CollectData is the servlet that reads the data and inserts the values in the database.

The code to connect to the servlet is as follows:


When I hit the url directly, everything works fine. But when I hit the submit button in the applet, which in-turn calls this servlet, nothing happens!

Can any body help me pointing out the mistake that I am doing in my code to hit the servlet with the specific URL?

Any pointers are greatly appreciated.


Regards, Sud.
SCJP 5 ScjpFAQ JLS
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18656
    
    8

Nothing happens? I would have thought that at least an exception would be thrown, which you could see in the Java console. Was there nothing there?
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

Just to avoid any confusion, I replaced my code with the following:


What this applet is supposed to do is, call the servlet named FirstServlet.do with the parameters name and status.

To test the hit, I did a System.out.println() in the servlet code that will print a string in the WLS console.

As stated earlier, when I hit the servlet directly [ "http://localhost:7001/test/FirstServlet.do?name="+name+"&status="+status" ], every thing works fine and I can see the string on the console.

But when I use the mentioned applet code, there is no output, neither an exception!

Any clues. Let me know if any other detail is required.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18656
    
    8

Of course there's no exception or output on the server side. Have you checked the Java console to see if the applet is throwing an exception yet? If not, then that is the first thing you should do next.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hit A Servlet From an Applet with values in the URL for the Servlet