String sUrl = "10.10.10.10/logoff.do";
HttpURLConnection conn =null;
try{
conn =(HttpURLConnection)new URL(sUrl).openConnection();
int result= conn.getResponseCode();
String re=conn.getResponseMessage();
if(result==HttpURLConnection.HTTP_OK){
InputStream in=conn.getInputStream();
byte[] b=new byte[1024];
String lss=null;while(in.read(b)>0) {
lss = new String(b,0,b.length,"utf-8");
}
System.out.println("连接成功!"); }else{
System.out.println("连接不成功!");
}
}catch(Exception e ){
e.printStackTrace();
}finally{
if(conn!=null){
conn.disconnect();
conn = null;
}
以上代码试图完成10.10.10.10/的logoff方法
但是问题出现了,虽然可以访问10.10.10.10/logoff.do
但是,当我不管关闭浏览器时,打开10.10.10.10网址时,
仍然是登陆状态,
该怎么办?才能在访问10.10.10.10时,处于登出页面???---------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------
HttpURLConnection conn =null;
try{
conn =(HttpURLConnection)new URL(sUrl).openConnection();
int result= conn.getResponseCode();
String re=conn.getResponseMessage();
if(result==HttpURLConnection.HTTP_OK){
InputStream in=conn.getInputStream();
byte[] b=new byte[1024];
String lss=null;while(in.read(b)>0) {
lss = new String(b,0,b.length,"utf-8");
}
System.out.println("连接成功!"); }else{
System.out.println("连接不成功!");
}
}catch(Exception e ){
e.printStackTrace();
}finally{
if(conn!=null){
conn.disconnect();
conn = null;
}
以上代码试图完成10.10.10.10/的logoff方法
但是问题出现了,虽然可以访问10.10.10.10/logoff.do
但是,当我不管关闭浏览器时,打开10.10.10.10网址时,
仍然是登陆状态,
该怎么办?才能在访问10.10.10.10时,处于登出页面???---------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------
就会退出
window.location.href="http://10.10.10.10/logoff.do";试试
为什么无法改变cookie的值呢?总是-1???