Servlet里取得url传来带有空格参数的问题
Test.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'Test.jsp' starting page</title>
</head>
<body>
<a href="/Tessss/Test?id=abcbbb b" >fdfds</a>
</body>
</html>
package com.ser;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Test extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html,charset=utf-8");
String id=request.getParameter("id");
System.out.println("id="+id);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}
为什么这个带有空格的URL我未做任何处理,后台能完整的打印出来啊?不是说URL要是带有空格参数的话要进行encode的吗为什么啊不解