在瀏覽器地址輸入,表示傳入一個參數test,值爲123 java
在index.jsp中嘗試使用EL表達式取出,代碼以下: 瀏覽器
<body> ${test} </body>
發現毫無結果,再使用requestScope嘗試取出: 服務器
<body> ${requestScope.test} </body>
發現仍是毫無結果,感到很是詫異,遂乾脆使用java腳本嘗試取出。 jsp
<body> <%request.getAttribute("test"); %> </body>
依然無解。 spa
以後發現,若使用已下代碼向request做用域賦值,則用上面代碼能夠取出 code
<% request.setAttribute("test", "123"); %>
查詢資料後發現,使用如下代碼能夠取出以前的請求參數:
EL: 作用域
<body> ${param.test} </body>
JAVA腳本: get
<body> <%=request.getParameter("test") %> </body>
結論就是:${param.name} 等價於 request.getParamter("name"),這兩種方法通常用於服務器從頁面或者客戶端獲取的內容。 test
${requestScope.name} 等價於${name}等價於request.getAttribute("name"),通常是從服務器傳遞結果到頁面,在頁面中取出服務器保存的值。 request