Java Web学习总结:HttpServletRequest

原文链接:blog.ouyangsihai.cn >> Java Web学习总结:HttpServletRequest

一、HttpServletRequest介绍

HttpServletRequest对象代表客户端的请求,当客户端通过HTTP协议访问服务器时,HTTP请求头中的所有信息都封装在这个对象中,通过这个对象提供的方法,可以获得客户端请求的所有信息。

二、jsp页面引入js,css文件的方式

精彩内容推荐

在eclipse中新建一个web项目,目录结构如下:

image

在jsp页面的最开始,获取项目的根路径:

<%
   String path = request.getContextPath();
   String basePath = request.getScheme() + "://"
           + request.getServerName() + ":" + request.getServerPort()
           + path + "/";
%>

在<head></head>中,插入下述代码:

<base href="<%=basePath%>" />

这句代码的作用是将整个页面的根路径设置为项目路径。

三、Request常用方法

1、获得客户机信息

getRequestURL() 返回客户端发出请求时的完整URL。
getRequestURI() 返回请求行中的资源名部分。
getQueryString () 返回请求行中的参数部分。
getRemoteAddr() 返回发出请求的客户机的IP地址。
getPathInfo() 返回请求URL中的额外路径信息。额外路径信息是请求URL中的位于Servlet的路径之后和查询参数之前的内容,它以"/"开头。
getRemoteHost() 返回发出请求的客户机的完整主机名。
getRemotePort() 返回客户机所使用的网络端口号。
getLocalAddr() 返回WEB服务器的IP地址。
getLocalName() 返回WEB服务器的主机名。
private void RequestMessages(HttpServletRequest req, HttpServletResponse resp) throws IOException{
    String reqUrl = req.getRequestURL().toString();//得到请求的URL地址
    String reqUri = req.getRequestURI();//得到请求的资源
    String queryString = req.getQueryString();//得到请求的URL地址中附带的参数
    String remoteAddr = req.getRemoteAddr();//得到来访者的IP地址
    String remoteHost = req.getRemoteHost();
    int remotePort = req.getRemotePort();
    String remoteUser = req.getRemoteUser();
    String method = req.getMethod();//得到请求URL地址时使用的方法
    String pathInfo = req.getPathInfo();
    String localAddr = req.getLocalAddr();//获取WEB服务器的IP地址
    String localName = req.getLocalName();//获取WEB服务器的主机名
    resp.setCharacterEncoding("UTF-8");//设置将字符以"UTF-8"编码输出到客户端浏览器
    //通过设置响应头控制浏览器以UTF-8的编码显示数据,如果不加这句话,那么浏览器显示的将是乱码
    resp.setHeader("content-type", "text/html;charset=UTF-8");
    PrintWriter out = resp.getWriter();
    out.write("获取到的客户机信息如下:");
    out.write("<br/>");
    out.write("请求的URL地址:"+reqUrl);
    out.write("<br/>");
    out.write("请求的资源:"+reqUri);
    out.write("<br/>");
    out.write("请求的URL地址中附带的参数:"+queryString);
    out.write("<br/>");
    out.write("来访者的IP地址:"+remoteAddr);
    out.write("<br/>");
    out.write("来访者的主机名:"+remoteHost);
    out.write("<br/>");
    out.write("使用的端口号:"+remotePort);
    out.write("<br/>");
    out.write("remoteUser:"+remoteUser);
    out.write("<br/>");
    out.write("请求使用的方法:"+method);
    out.write("<br/>");
    out.write("pathInfo:"+pathInfo);
    out.write("<br/>");
    out.write("localAddr:"+localAddr);
    out.write("<br/>");
    out.write("localName:"+localName);
}
2.png

2、获得客户机请求头

  • getHeader(string name)方法:String

  • getHeaders(String name)方法:Enumeration

  • getHeaderNames()方法

private void RequestHead(HttpServletRequest req, HttpServletResponse resp) throws IOException{
    resp.setCharacterEncoding("UTF-8");//设置将字符以"UTF-8"编码输出到客户端浏览器
    //通过设置响应头控制浏览器以UTF-8的编码显示数据
    resp.setHeader("content-type", "text/html;charset=UTF-8");
    PrintWriter out = resp.getWriter();
    Enumeration<String> reqHeadInfos = req.getHeaderNames();//获取所有的请求头
    out.write("获取到的客户端所有的请求头信息如下:");
    out.write("<br/>");
    while (reqHeadInfos.hasMoreElements()) {
        String headName = (String) reqHeadInfos.nextElement();
        String headValue = req.getHeader(headName);//根据请求头的名字获取对应的请求头的值
        out.write(headName+":"+headValue);
        out.write("<br/>");
    }
    out.write("<br/>");
    out.write("获取到的客户端Accept-Encoding请求头的值:");
    out.write("<br/>");
    String value = req.getHeader("Accept-Encoding");//获取Accept-Encoding请求头对应的值
    out.write(value);
    
    Enumeration<String> e = req.getHeaders("Accept-Encoding");
    while (e.hasMoreElements()) {
        String string = (String) e.nextElement();
        System.out.println(string);
    }
}
image

3、获得客户机请求参数

getParameter(String name) 根据name获取请求参数(常用)
getParameterValues(String name) 根据name获取请求参数列表(常用)
getParameterMap() 返回的是一个Map类型的值,该返回值记录着前端(如jsp页面)所提交请求中的请求参数和请求参数值的映射关系。(编写框架时常用)

如下表单:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
   String path = request.getContextPath();
   String basePath = request.getScheme() + "://"
           + request.getServerName() + ":" + request.getServerPort()
           + path + "/";
%>
<html>
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>表单提交</title>
<link href="css/bootstrap.css" rel="stylesheet">
<script src="js/jquery-3.2.1.js"></script>
<script src="js/bootstrap.js"></script>
</head>
<body>
    <form class="form-horizontal" action="<%=request.getContextPath()%>/GetParameterRequest.html" role="form" method="post">
        <div class="form-group">
            <label for="firstname" class="col-sm-1 control-label">名字</label>
            <div class="col-sm-3">
                <input type="text" class="form-control" name="name"
                    placeholder="请输入名字">
            </div>
        </div>
        <div class="form-group">
            <label for="lastname" class="col-sm-1 control-label">年龄</label>
            <div class="col-sm-3">
                <input type="text" class="form-control" name="age"
                    placeholder="请输年龄">
            </div>
        </div>
        <div class="form-group">
            <label for="lastname" class="col-sm-1 control-label">性别</label>
            <div class="col-sm-3">
                <input type="radio" name="sex" value="男" checked>男
                <input type="radio" name="sex" value="女">女
            </div>
        </div>
        <div class="form-group">
            <label for="lastname" class="col-sm-1 control-label">爱好</label>
            <div class="col-sm-3">
                <input type="checkbox" name="aihao" value="唱歌">唱歌
                <input type="checkbox" name="aihao" value="上网">上网
                <input type="checkbox" name="aihao" value="游戏">游戏
                <input type="checkbox" name="aihao" value="看书">看书
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-1 col-sm-3">
                <button type="submit" class="btn btn-default">提交</button>
                <button type="reset" class="btn btn-default">重置</button>
            </div>
        </div>
    </form>
</body>
</html>

使用getParameter方法和getParameterValues方法接收表单参数:

public class GetParameterRequest extends HttpServlet{
 
    private static final long serialVersionUID = 3903946972744326948L;
    
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }
    
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //客户端是以UTF-8编码提交表单数据的,所以需要设置服务器端以UTF-8的编码进行接收,否则对于中文数据就会产生乱码
        req.setCharacterEncoding("UTF-8");
        //获取名字
        String name = req.getParameter("name");
        //获取年龄
        String age = req.getParameter("age");
        //获取性别
        String sex = req.getParameter("sex");
        //获取爱好,因为可以选中多个值,所以获取到的值是一个字符串数组,因此需要使用getParameterValues方法来获取
        String[] aihaos = req.getParameterValues("aihao");
        
        String aihao = "";
        if(aihaos != null){
            for (int i = 0; i < aihaos.length; i++) {
                if(i == aihaos.length - 1){
                    aihao += aihaos[i];
                } else {
                    aihao += aihaos[i] + ",";
                }
            }
        }
        System.out.println("名字:" + name);
        System.out.println("年龄:" + age);
        System.out.println("性别:" + sex);
        System.out.println("爱好:" + aihao);
        req.setAttribute("aihao", aihao);
        //设置服务器端以UTF-8编码输出数据到客户端
        resp.setCharacterEncoding("UTF-8");
        this.getServletContext().getRequestDispatcher("/request.jsp").forward(req, resp);
    }
}

响应页面:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
   String path = request.getContextPath();
   String basePath = request.getScheme() + "://"
           + request.getServerName() + ":" + request.getServerPort()
           + path + "/";
%>
<html>
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>表单提交</title>
<link href="css/bootstrap.css" rel="stylesheet">
<script src="js/jquery-3.2.1.js"></script>
<script src="js/bootstrap.js"></script>
</head>
<body>
<table class="table">
   <thead>
      <tr>
         <th>名称</th>
         <th>结果</th>
      </tr>
   </thead>
   <tbody>
      <tr>
         <td>姓名</td>
         <td><%=request.getParameter("name") %></td>
      </tr>
      <tr>
         <td>年龄</td>
         <td><%=request.getParameter("age") %></td>
      </tr>
      <tr>
         <td>性别</td>
         <td><%=request.getParameter("sex") %></td>
      </tr>
      <tr>
         <td>爱好</td>
         <td><%=request.getAttribute("aihao") %></td>
      </tr>
   </tbody>
</table>
</body>
</html>

提交如下表单:

image

后台打印:

image

运行结果如下:

image

四、request接收表单提交中文参数乱码问题

1、以POST方式提交表单中文参数的乱码问题

有如下表单:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
   String path = request.getContextPath();
   String basePath = request.getScheme() + "://"
           + request.getServerName() + ":" + request.getServerPort()
           + path + "/";
%>
<html>
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>表单提交</title>
<link href="css/bootstrap.css" rel="stylesheet">
<script src="js/jquery-3.2.1.js"></script>
<script src="js/bootstrap.js"></script>
</head>
<body>
    <form class="form-horizontal" action="<%=request.getContextPath()%>/PostRequest.html" role="form" method="post">
        <div class="form-group">
            <label for="firstname" class="col-sm-1 control-label">名字</label>
            <div class="col-sm-3">
                <input type="text" class="form-control" name="name"
                    placeholder="请输入名字">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-1 col-sm-3">
                <button type="submit" class="btn btn-default">提交</button>
                <button type="reset" class="btn btn-default">重置</button>
            </div>
        </div>
    </form>
</body>
</html>

后台接收参数:

public class PostRequest extends HttpServlet{
 
    private static final long serialVersionUID = 3903946972744326948L;
    
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }
    
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name = req.getParameter("name");
        System.out.println("名字:" + name);
    }
}

提交数据:

image

运行结果:

image

之所以会产生乱码,就是因为服务器和客户端沟通的编码不一致造成的,因此解决的办法是:在客户端和服务器之间设置一个统一的编码,之后就按照此编码进行数据的传输和接收。

由于客户端是以UTF-8字符编码将表单数据传输到服务器端的,因此服务器也需要设置以UTF-8字符编码进行接收,通过setCharacterEncoding方法统一编码格式:

public class PostRequest extends HttpServlet{
 
    private static final long serialVersionUID = 3903946972744326948L;
    
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }
    
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //设置服务器以UTF-8的编码接收数据
        req.setCharacterEncoding("UTF-8");
        String name = req.getParameter("name");
        System.out.println("名字:" + name);
    }
}

重新提交表单,中文乱码解决:

image

2、以GET方式提交表单中文参数的乱码问题

有如下表单:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
   String path = request.getContextPath();
   String basePath = request.getScheme() + "://"
           + request.getServerName() + ":" + request.getServerPort()
           + path + "/";
%>
<html>
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>表单提交</title>
<link href="css/bootstrap.css" rel="stylesheet">
<script src="js/jquery-3.2.1.js"></script>
<script src="js/bootstrap.js"></script>
</head>
<body>
    <form class="form-horizontal" action="<%=request.getContextPath()%>/GetRequest.html" role="form" method="get">
        <div class="form-group">
            <label for="firstname" class="col-sm-1 control-label">名字</label>
            <div class="col-sm-3">
                <input type="text" class="form-control" name="name"
                    placeholder="请输入名字">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-1 col-sm-3">
                <button type="submit" class="btn btn-default">提交</button>
                <button type="reset" class="btn btn-default">重置</button>
            </div>
        </div>
    </form>
</body>
</html>

后台接收参数:

public class GetRequest extends HttpServlet{
 
    private static final long serialVersionUID = 3903946972744326948L;
    
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }
    
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name = req.getParameter("name");
        System.out.println("名字:" + name);
    }
}

提交数据:

image

运行结果:

image

之所以会产生乱码,对于以get方式传输的数据,默认的还是使用ISO8859-1这个字符编码来接收数据,客户端以UTF-8的编码传输数据到服务器端,而服务器端的request对象使用的是ISO8859-1这个字符编码来接收数据,服务器和客户端沟通的编码不一致因此才会产生中文乱码的。

解决方法:

在接收到数据后,先获取request对象以ISO8859-1字符编码接收到的原始数据的字节数组,然后通过字节数组以指定的编码构建字符串

public class GetRequest extends HttpServlet{
 
    private static final long serialVersionUID = 3903946972744326948L;
    
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }
    
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name = req.getParameter("name");
        //以ISO8859-1字符编码接收到的原始数据的字节数组,然后通过字节数组以指定的编码构建字符串
        name = new String(name.getBytes("ISO8859-1") , "UTF-8");
        System.out.println("名字:" + name);
    }
}

重新提交表单,中文乱码解决:

image

五、Request对象实现请求转发

4.1、请求转发的基本概念

请求转发:指一个web资源收到客户端请求后,通知服务器去调用另外一个web资源进行处理。

请求转发的应用场景:MVC设计模式

在Servlet中实现请求转发的两种方式:

1、通过ServletContext的getRequestDispatcher(String path)方法,该方法返回一个RequestDispatcher对象,调用这个对象的forward方法可以实现请求转发。

例如:将请求转发的test.jsp页面

RequestDispatcher reqDispatcher =this.getServletContext().getRequestDispatcher("/test.jsp");
reqDispatcher.forward(request, response);

 2、通过request对象提供的getRequestDispatche(String path)方法,该方法返回一个RequestDispatcher对象,调用这个对象的forward方法可以实现请求转发。

例如:将请求转发的test.jsp页面

request.getRequestDispatcher("/test.jsp").forward(request, response);

request对象同时也是一个域对象(Map容器),开发人员通过request对象在实现转发时,把数据通过request对象带给其它web资源处理。

例如:请求RequestDemo06 Servlet,RequestDemo06将请求转发到test.jsp页面

package gacl.request.study;

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 RequestDemo06 extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        String data="大家好,我是孤傲苍狼,我正在总结JavaWeb";
        /**
         * 将数据存放到request对象中,此时把request对象当作一个Map容器来使用
         */
        request.setAttribute("data", data);
        //客户端访问RequestDemo06这个Servlet后,RequestDemo06通知服务器将请求转发(forward)到test.jsp页面进行处理
        request.getRequestDispatcher("/test.jsp").forward(request, response);
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        doGet(request, response);
    }
}

test.jsp页面代码如下:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Request对象实现请求转发</title>
  </head>
  
  <body>
      使用普通方式取出存储在request对象中的数据:
      <h3 style="color:red;"><%=(String)request.getAttribute("data")%></h3>
     使用EL表达式取出存储在request对象中的数据:
     <h3 style="color:red;">${data}</h3>
  </body>
</html>

request对象作为一个域对象(Map容器)使用时,主要是通过以下的四个方法来操作

  • setAttribute(String name,Object o)方法,将数据作为request对象的一个属性存放到request对象中,例如:request.setAttribute("data", data);
  • getAttribute(String name)方法,获取request对象的name属性的属性值,例如:request.getAttribute("data")
  • removeAttribute(String name)方法,移除request对象的name属性,例如:request.removeAttribute("data")
  • getAttributeNames方法,获取request对象的所有属性名,返回的是一个,例如:Enumeration<String> attrNames = request.getAttributeNames();

4.2、请求重定向和请求转发的区别

一个web资源收到客户端请求后,通知服务器去调用另外一个web资源进行处理,称之为请求转发/307。

一个web资源收到客户端请求后,通知浏览器去访问另外一个web资源进行处理,称之为请求重定向/302。

参考资料

http://www.cnblogs.com/xdp-gacl/p/3798347.html
https://www.cnblogs.com/Zender/p/7647503.html
精彩内容推荐

文章有不当之处,欢迎指正,如果喜欢微信阅读,你也可以关注我的微信公众号:好好学java,获取优质学习资源。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 157,198评论 4 359
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 66,663评论 1 290
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 106,985评论 0 237
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,673评论 0 202
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 51,994评论 3 285
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,399评论 1 211
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,717评论 2 310
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,407评论 0 194
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,112评论 1 239
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,371评论 2 241
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,891评论 1 256
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,255评论 2 250
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,881评论 3 233
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,010评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,764评论 0 192
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,412评论 2 269
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,299评论 2 260

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,087评论 18 139
  • 国家电网公司企业标准(Q/GDW)- 面向对象的用电信息数据交换协议 - 报批稿:20170802 前言: 排版 ...
    庭说阅读 10,482评论 6 13
  • 浮生偷得半日闲 一寸光阴一寸金 繁华落尽青春逝 百事蹉跎万念灰 少时执着轻狂梦 老而无功徒伤悲 情归何处空思量 只...
    朝花夕拾721111阅读 272评论 0 0
  • 1、鱼盘,水彩本,血压计,衣服,月饼 狗宝宝把鱼盘推翻了,里面的汤汁洒在旁边的水彩本上,狗宝宝拖着水彩本上蹿下跳,...
    Maggie昔年阅读 214评论 1 1
  • 1 昨天,我在知识型IP潜能营分享后,有个伙伴M来找我聊了他自己的一个实际情况: 自己有个好朋友、同事L,开始的水...
    易仁永澄阅读 572评论 2 10