发表时间:2009-01-06
最后修改:2009-01-06
调用服务器端方法时,根据服务器端方法访问另一个链接后返回的结果进行判断的方法
public String doCheckAuthor(){
Map params = getStrictParams();
if (params.get("传递的参数") != null) {
this.setMessage(params.get("传递的参数").toString().trim());
}
try {
String checkUrl = "http://地址:xxx.jsp?传递的参数="
+ params.get("传递的参数").toString().trim();
URL url = new URL(checkUrl);
HttpURLConnection urlConnection = (HttpURLConnection) url
.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(
urlConnection.getInputStream()));
//System.out.println(in.readLine().toString());
if(in.readLine().toString().equals("1")){
this.setMessage("1");
}
} catch (Exception e) {
//e.printStackTrace();
this.getLog().debug(ExceptionUtils.getExceptionTraceString(e));
}
return "checkAutor";
}