Post to the Same Page : Form Action « JSTL « Java Tutorial






<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
  <head>
    <title>If with Body</title>
  </head>

  <body>
    <c:if test="${pageContext.request.method=='POST'}">
      <c:if test="${param.guess=='5'}">You guessed my number!
      <br />

      <br />

      <br />
      </c:if>

      <c:if test="${param.guess!='5'}">You did not guess my number!
      <br />

      <br />

      <br />
      </c:if>
    </c:if>

    <form method="post">Guess what number I am thinking of?
    <input type="text" name="guess" />

    <input type="submit" value="Try!" />

    <br />
    </form>
  </body>
</html>
  Download:  JSTLPostToSamePage.zip( 1,225 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