Use Form Parameter as Request Parameters in JSTL : Form Action « JSTL « Java Tutorial






<html>
  <head>
    <title>Set page parameters (2)</title>
  </head>
  <body>
    This page allows you to enter information that is sent as request
    parameters to another page.<br />

    The next page list the different parameters with their values. <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 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 noun:</td>
            <td><input type="text" name="noun" /></td>
        </tr>
      </table>
      <input type="submit" value="Send parameters" />
    </form>
  </body>
</html>
<%@ 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 />
    <ul>
      <c:forEach var="pageParameter" items="${param}">
        <li> <c:out value="pageParameter" /> has the values
        <c:forEach var="currentValue" items="${pageParameter.value}">
          <c:out value="${currentValue}" />
        </c:forEach>
      </c:forEach>
    </ul>
  </body>
</html>
  Download:  JSTLFormParameterAsRequestParameters.zip( 1,022 k)








24.18.Form Action
24.18.1.Post to the Same Page
24.18.2.Link to Self With Parameter Passing
24.18.3.JSTL Form Parameters
24.18.4.Use Form Parameter as Request Parameters in JSTL