JSTL Form: Using TextField : Form TextField « JSTL « Java

JSTL Form: Using TextField

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<c:if test="${pageContext.request.method=='POST'}">
    <c:when test="${param.add!=null}">
      <c:if test="${list!=null}">
        <c:set var="list" value="${list}," scope="session" />

      <c:set var="list" value="${list}${param.item}"
      scope="session" />

    <c:when test="${param.remove!=null}">
      <c:set var="list2" value="" />

      <c:forEach var="item" items="${list}">
        <c:if test="${item!=param.item}">
          <c:if test="${list2!=''}">
            <c:set var="list2" value="${list2}," />

          <c:set var="list2" value="${list2}${item}" />

      <c:set var="list" value="${list2}" scope="session" />

      <c:remove var="list2" />

    <title>Updatable Collections</title>

    <table border="0">
      <form method="post">
        <tr bgcolor="blue">
          <td colspan="2">
            <font color="white">Updatable Collections</font>

          <td valign="top">
            <select NAME="choice" SIZE="5" width="20">
              <c:forEach var="item" items="${list}">
                  <c:out value="${item}" />

          <td valign="top">Enter a item to add or remove.
          <br />

          <input width="20" maxwidth="20" name="item" size="20" />

          <br />

          <input type="submit" name="add" value="Add" />

          <input type="submit" name="remove" value="Remove" />


JSTL-Form-TextField.zip( 852 k)

Related examples in the same category

1.JSTL Submit Form TextField Action
2.JSTL Form Action: Get TextField Value
3.Property Access