Java Tutorial/JSTL/URL — различия между версиями

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

Версия 17:44, 31 мая 2010

Build Custom Tag Based On JSTL

<%@ taglib prefix="myTag" tagdir="/WEB-INF/tags" %>

<html>
<head>
<title>EL Type Conversion Examples</title>
</head>
<body>
<h1>EL Type Conversion Examples</h1>
<myTag:CharacterType val="this is it"/>
<myTag:CharacterType val="8"/>
<myTag:CharacterType val="3.0001"/>
<br/>
<myTag:DoubleType val=""/>
<myTag:DoubleType val="-3"/>
<br/>
<myTag:BooleanType val=""/>
<myTag:BooleanType val="true"/>
<myTag:BooleanType val="t"/>
<myTag:BooleanType val="3.1"/>

</body>
</html>





Build URL with Parameters

<%@ taglib uri="http://java.sun.ru/jstl/core" prefix="c" %>
<c:set var="originalURL" value="http://localhost:8080/chapter05/core/url/url.jsp" />
<html>
  <head>
    <title>the c:url action </title>
  </head>
  <body>
    This page takes 3 values that you specify, and forwards them to another JSP.
    That JSP will create a URL to another page, that then extracts the
    parameters and displays them.
    <p />
      <form action="createURL.jsp" method="post">
        <table>
          <tr><td>Enter name:</td>
              <td><input type="text" name="name"   /></td></tr>
          <tr><td>Enter age:</td>
              <td><input type="text" name="age"    /></td></tr>
          <tr><td>Enter gender:</td >
              <td><input type="text" name="gender" /></td></tr>
        </table>
        <input type="submit" value="Submit details" />
      </form>
  </body>
</html>