Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

APPLET TO ASP COMMUNICATION

 
Vishnu Murthy
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
can u please answer to my small query
"Can an Applet communicate with ASP?"
if Yes How?
thanks in advance
 
Jayakumar Gopalan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes applet can communicate with ASP. Following is the code which I am using for applet to communicate with ASP (or any thing on the server which supports http request and response).
try
{
String dataToPost = " "; /* the data you want to post */
URL url = new URL("http://servername/aspfile.asp");
URLConnection urlCon = url.openConnection();
urlCon.setDoOutput( true );
urlCon.setRequestProperty("Content-Type", "application/x-www-form-urlencoded" );
/*to do post uncomment the following line*/
/* urlCon.setDoInput(true);
if( scripsToFetch != null )
{
//POST scrip datas
OutputStream os =urlCon.getOutputStream();
os.write( dateToPost.getBytes());
}
*/
String responseData="";
try
{
String sTmpLine= "";
BufferedReader br = new BufferedReader( new InputStreamReader(urlCon.getInputStream()));
while( ( sTmpLine = br.readLine() ) != null )
{
responseData += sTmpLine;
} //end while loop
}//end of tryblock
catch(Exception e)
{ }

}
catch(Exception e)
{
}
Hope this helps.
Regards,
Jayakumar
 
Jack Wang
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, thank you for the code.
2 questions about this code.
1. what is scripsToFetch in "if( scripsToFetch != null ) { "
2. How to fetch the property in an ASP page? using Request object? I really like to learn how to send data from a Java applet to server.
Thank you very much!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic