Use JSTL C:Out : Output « JSTL « Java Tutorial






<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
  <head>
    <title>Query String Example</title>
  </head>

  <body>Your favorite color is: 
  <b>
    <c:out value="${param.color}" />
  </b>

  <br />

  <br />

  Choose your favorite color:
  <br />

  <br />

  <a
  href="<c:out value="${pageContext.request.requestURI}"/>?color=red">
  red</a>

  <br />

  <a
  href="<c:out value="${pageContext.request.requestURI}"/>?color=blue">
  blue</a>

  <br />

  <a
  href="<c:out value="${pageContext.request.requestURI}"/>?color=green">
  green</a>

  <br />

  <a
  href="<c:out value="${pageContext.request.requestURI}"/>?color=yellow">
  yellow</a>

  <br />

  <a
  href="<c:out value="${pageContext.request.requestURI}"/>?color=other">
  other</a>

  <br />
  </body>
</html>
  Download:  JSTLCOut.zip( 5,347 k)








24.2.Output
24.2.1.Output Value
24.2.2.Use JSTL C:Out
24.2.3.Output Form Default Value
24.2.4.Output Default Value
24.2.5.Do Calculation in JSTL C:Out