Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet to Applet

 
Ravi Gupta
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.
. . .
----------------------------------------------------------------------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic