String rip=this.getCodeBase().toString();
URL reqUrl = new URL(rip+"com/sc/system/sys_monitor/dsServlet?action=get");
URLConnection urlcon = reqUrl.openConnection();
urlcon.connect();
在servlet中对参数action进行相应判断,作出相应处理即可。
URL reqUrl = new URL(rip+"com/sc/system/sys_monitor/dsServlet?action=get");
URLConnection urlcon = reqUrl.openConnection();
urlcon.connect();
在servlet中对参数action进行相应判断,作出相应处理即可。
URL myUrl = new URL(host);
URLConnection myConn = myUrl.openConnection();
myConn.setRequestProperty("CONTENT_TYPE","application/octet-stream");
myConn.setDoInput(true);
myConn.setDoOutput(true); os = new ObjectOutputStream(myConn.getOutputStream());
os.writeObject("");
os.flush();
os.close(); is = new ObjectInputStream(myConn.getInputStream());
result = (Vector)is.readObject();
servlet:public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
doPost(request,response);
} public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
ObjectInputStream is = null;
ObjectOutputStream os = null;
String action = "";
try {
is = new ObjectInputStream(req.getInputStream());
action = (String)is.readObject();
os = new ObjectOutputStream(res.getOutputStream());
try {
v = doSearch(dsCom);
os.writeObject(v);
os.writeObject("ret");
os.flush();
os.close();
} catch (Exception ex) {
ex.printStackTrace();
try{
System.err.println("treeServlet [service] err:"+ex);
if(is!=null) is.close();
if(os!=null) os.close();
}catch(Exception e){};
}catch (Exception ex) {
ex.printStackTrace();
try{
System.err.println("treeServlet [service] err:"+ex);
if(is!=null) is.close();
if(os!=null) os.close();
}catch(Exception e){};
}