- 浏览: 2416 次
最新评论
文章列表
String a = String.valueOf(2);
//integer to numeric string
int i = Integer.parseInt(a);
//numeric string to an int
String a = String.valueOf(2);
//integer to numeric string
int i = Integer.parseInt(a);
//numeric string to an int
1、request.getRequestURL()
返回的是完整的url,包括Http协议,端口号,servlet名字和映射路径,但它不包含请求参数。
2、request.getRequestURI()
得到的是request URL的部分值,并且web容器没有decode过的
3、request.getContextPath()
返回 the context of the request.
4、request.getServletPath()
返回调用servlet部分的url.
5、request.getQueryString()
返回url路径?后面的查询字符串 ...
public String getIpAddr(HttpServletRequest request){
String ipAddress = null;
ipAddress = request.getHeader("x-forwarded-for");
if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = r ...
1.指定编码UTF-8
传递页面
URLEncoder.encode(name,"UTF-8")
获取页面
String name=new String(request.getPatameter(name).getBytes("ISO_8859-1"),"UTF-8");
2.默认平台编码
传递页面
URLEncoder.encode(name);
获取页面
String name=new String(request.getPatameter(name).getBytes("ISO_8859-1));
3 ...