摘要:private String getKobe(String mburl){ URL url = null; BufferedReader reader = null; String str=""; try { url = new URL(mburl); reader = new BufferedReader(new InputStreamReader(url.openStream(),"UTF-8"));String line=null; do { line = reader.readLine(); if(line!=null) { str +=line
阅读全文
摘要:导入包:import javax.servlet.ServletContext;import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpSession;import org.apache.struts2.ServletActionContext; import org.apache.struts2.interceptor.CookiesAwar
阅读全文
摘要:import java.util.Date;String tstamp = getUnixTime(new Date())+"";public static long getUnixTime(Date date){ if( null == date ) { return 0; } return date.getTime()/1000;}
阅读全文
摘要:问题描述:通过ajax传值,有时出现乱码和特殊字符。传中文出现乱码,传密码,对特殊字符的处理有问题。如jsp中输入的密码是:1111++11,在java中获取时是:1111 11.解决思路:通过加密和解密操作实现。(采取encodeURIComponent)具体如下:jsp页面中,password="+encodeURIComponent(encodeURIComponent(password));java中password = java.net.URLDecoder.decode(password,"UTF-8");
阅读全文
摘要:<HTML><HEAD> <TITLE>copy</TITLE> <SCRIPT language=javascript type=text/javascript> function kobe() { var url = document.getElementById("kobe").value; window.clipboardData.setData("Text",url); alert("已经复制到剪贴板!");} </SCRIPT></HEAD>
阅读全文