Set page parameters : Page Context « JSP « Java






Set page parameters

<html>
  <head>
    <title>Set page parameters</title>
  </head>
  <body>
    This page allows you to enter information that is sent as request
    parameters to another page. The next page lists them. <P />

    <form action="listPageParameters.jsp" method="get">
      <table>
        <tr><td>Enter an adjective:</td>
            <td><input type="text" name="adjective" /></td>
        </tr>
        <tr><td>Enter a noun:</td>
            <td><input type="text" name="noun" /></td>
        </tr>
        <tr><td>Enter a color:</td>
            <td><input type="text" name="color" /></td>
        </tr>
      </table>
      <input type="submit" value="Send parameters" />
    </form>
  </body>
</html>

//listPageParameters.jsp


<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<html>
  <head>
    <title>List page parameters</title>
  </head>
  <body>
    You entered the following parameters:<br />
    <ol>
      <%-- 'param' is an implicit object. It is a Map that maps a 'key'
           (the parameter name) to a 'value' --%>
      <c:forEach var="pageParameter" items="${param}">
        <li> <c:out value="${pageParameter.key}" /> = <c:out value="${pageParameter.value}" />
      </c:forEach>
    </ol>
  </body>
</html>



           
       








Related examples in the same category

1.Page directive attributes
2.Application Object
3.Set JSP PageContext attributes
4.JSP page scope