HttpServletRequest獲取post的參數

HttpServletRequest獲取post的參數 同事的錯誤寫法:java

public @ResponseBody String registerLogin(HttpServletRequest request, HttpServletResponse response) {
//        String userName = request.getParameter("userName");

正確:app

try {
    BufferedReader reader = request.getReader();
    while ((line = reader.readLine()) != null)
        sb.append(line);
    service = sb.toString();
} catch (Exception e) {
    e.printStackTrace();
}
相關文章
相關標籤/搜索