jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes Servlet to Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet to Applet" Watch "Servlet to Applet" New topic

Servlet to Applet

Ravi Gupta
Ranch Hand

Joined: Jul 15, 2006
Posts: 38

I am trying to develop an application where the user enters some data on a JSP page, the JSP then sends this data to a servlet, the servlet processes this data and sends this data to an applet so that the applet can draw a graph based on that data. I am not able to pass the data from servlet to applet. Please help.

help your PC help you best
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
What does "I am not able" mean? How are you trying to do it?

The normal way of passing data to an applet would be to use <param> tags inside of the <applet> tag.
Chandan Ghosh

Joined: Jun 13, 2005
Posts: 21

This case, you have to use the Java Network APIs...
Use URL & URLConnection to call a servlet and read from servlet's output...
String url = "http://www.abc.com/servlet/TestServlet?Name=Chandan";
URL testServlet = new URL( url );
URLConnection servletConnection = testServlet.openConnection();
inputStreamFromServlet = servletConnection.getInputStream();

// Now read the input from the servlet.
. . .

Thanks & Regards,<br />Chandan Ghosh<br />SCJP1.4
I agree. Here's the link: http://aspose.com/file-tools
subject: Servlet to Applet
It's not a secret anymore!