Java Tutorial/JSTL/Redirect

Материал из Java эксперт
Перейти к: навигация, поиск

JSTL Redirect

<%@ taglib uri="http://java.sun.ru/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.ru/jstl/core-rt" prefix="c-rt" %>
<%@ taglib uri="http://java.sun.ru/jstl/sql" prefix="sql" %>

<c:if test="${pageContext.request.method=="POST"}">
  <c:if test="${param.reg!=null}">
    <c:redirect url="http:www.jexp.ru" />
  </c:if>
  <h3 color="red">Sorry, we have no one registered with that
    name.</h3>
</c:if>

<html>
  <head>
    <title>Welcome</title>
  </head>
  <body>
    Please login.<br>
    <form method="POST">
      <table>
        <tr>
          <td width="100%" colspan="2" bgcolor="#0000FF">
            <p align="center">
              <b>
                <font color="#FFFFFF" size="4">Login</font>
              </b>
            </p>
          </td>
        </tr>
        <tr>
          <td width="26%">Login Name</td>
          <td width="74%">
          <input type="text" name="uid" size="20" />
          </td>
        </tr>
        <tr>
          <td width="26%">Password</td>
          <td width="74%">
            <input type="password" name="pwd" size="20" />
          </td>
        </tr>
        <tr>
          <td width="100%" colspan="2">
            <p align="center">
              <input type="submit" value="Login" name="Login" />
              <input type="submit" value="Register" name="reg" />
            </p>
          </td>
        </tr>
      </table>
      <P>&#160;</p>
    </form>
  </body>
</html>