Get URL request parameters on JSP page __js

Source: Internet
Author: User
Tags tld
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.