JSP page
When using the JSTL's expression language, the request parameters are made in the available object implicit. This example demonstrates you to include the value of a request parameter from the query string or posted data in the gene Rated output:
Flip: When using Jstl, the URL request parameter is placed in the implied object param , and the following example shows how to get the request parameter from the URL
<%--Declare The core library--%>
<%@ taglib uri= "/web-inf/tld/c.tld" prefix= "C"%> <c
: choose>
param.name} "> Please
Enter your name.
</c:when>
<c:otherwise>
Hello <b><c:out value= "${param.name}"/></ b>!
</c:otherwise>
</c:choose>
When you request a page using the following URL
Http://hostname.com/mywebapp/mypage.jsp?name=John+Smith
Page display:
Hello <b>john smith</b>!
Use <c:out value= "${param.name}" for request parameter name /> Output
In addition, if there are spaces in the request parameter to use + to separate
use of the Sturts framework
When forwarding with an action class, you can call Request.getparameter ("name") in the action class to get the request parameters.
When forwarding to the target page, the request parameter still exists in the requests, so the target page can still be removed by the Param object.
This method also applies to situations where only direct forwarding to a page is done via forwardaction.