EL表达式在不同范围如何取值:
<% pageContext.setAttribute("book", "红楼梦"); request.setAttribute("book", "水浒传"); session.setAttribute("book", "三国演义"); application.setAttribute("book", "西游记"); %> <!-- 当key值相同的时候,并且没有指明在什么范围内取值的话,会取最小范围内的值返回 --> ${book } <br/> <!-- 获取不同范围内的值 --> pageScope:${pageScope.book } <br /> requestScope:${requestScope.book } <br /> sessionScope:${sessionScope.book } <br /> applicationScope:${applicationScope.book } <br /> <hr/> <input type="text" value = "${pageScope.book }" /> <input type="text" value = "${pageScope[‘book‘]}" /> <input type = "text" value = "<%=request.getParameter("user_id")==null?"":request.getParameter("user_id") %>" /><br/> param:相当于request.getParameter("user_id"); <input type= "text" value = "${param.user_id }" /><br/> paramValues(一key多值):相当于request.getParameterValues("user_id");<input type = "text" value= "${paramValues }" />