当前位置: 技术问答>java相关
如何完成Applet与Jsp之间的通信???急!!!!一定给分
来源: 互联网 发布时间:2015-05-25
本文导语: 我用APPLET和JSP编写了一个网页,现在想将APPLET中的鼠标点击坐标传给JSP,并将结果返回服务器处理,如何完成? 望大家多给建议,一定给分,万分感谢!! | try something like import java.net.*; i...
我用APPLET和JSP编写了一个网页,现在想将APPLET中的鼠标点击坐标传给JSP,并将结果返回服务器处理,如何完成?
望大家多给建议,一定给分,万分感谢!!
望大家多给建议,一定给分,万分感谢!!
|
try something like
import java.net.*;
import java.io.*;
int x= 12;
int y= 20;
URL urlInfo = new URL("http://yourhost/jsp/somejsp.jsp");
HttpURLConnection connection = (HttpURLConnection)
urlInfo.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
PrintStream out = new PrintStream(connection.getOutputStream());
out.println("x="+x+"&y="+y);
out.close();
DataInputStream in =
new DataInputStream(connection.getInputStream());
String sIn = in.readLine();
in.close();
import java.net.*;
import java.io.*;
int x= 12;
int y= 20;
URL urlInfo = new URL("http://yourhost/jsp/somejsp.jsp");
HttpURLConnection connection = (HttpURLConnection)
urlInfo.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
PrintStream out = new PrintStream(connection.getOutputStream());
out.println("x="+x+"&y="+y);
out.close();
DataInputStream in =
new DataInputStream(connection.getInputStream());
String sIn = in.readLine();
in.close();
|
http://yourhost/jsp/somejsp.jsp