title: value in input text in JSP from result query
body: <blockquote>
    <p>I have this index.jsp file where all the list of items is displayed and can
    be updated >by clicking the item name:</p>
  </blockquote>
  
  <pre><code>    &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
          pageEncoding="ISO-8859-1"%&gt;
      &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt;
      &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%&gt;
      &lt;!DOCTYPE html&gt;
      &lt;html&gt;
      &lt;head&gt;
      &lt;%@ include file="/pages/commons/scripts.jsp"%&gt;
      &lt;title&gt;Pabebe Inventory Store&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;c:if test="${not empty success}"&gt;
              &lt;script type="text/javascript"&gt;
                  alert("Item successfully added.");
              &lt;/script&gt;
              &lt;c:remove var="success" scope="request" /&gt;
          &lt;/c:if&gt;
          &lt;c:choose&gt;
              &lt;c:when test="${not empty user}"&gt;
                  Hi &lt;c:out value="${user.firstName}" /&gt;!&lt;br&gt;
                  &lt;a href="LogOut"&gt;Logout&lt;/a&gt;
                  &lt;a href="AddItem"&gt;Add new item&lt;/a&gt;
              &lt;/c:when&gt;
              &lt;c:otherwise&gt;
                  Hello please click &lt;a href="Login"&gt;Login&lt;/a&gt;
              &lt;/c:otherwise&gt;
          &lt;/c:choose&gt;
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;form id="searchItem" method="POST" action="ItemList"&gt;
                          &lt;input type="text" id="searchkeyword" name="searchkeyword"
                              value="&lt;c:out value="${searchkeyword}"/&gt;" /&gt;&lt;input type="submit"
                              value="Search" /&gt;
                      &lt;/form&gt;
                  &lt;/td&gt;
                  &lt;td&gt;
                      &lt;form id="resetItem" method="GET" action="ItemList"&gt;
                          &lt;input type="submit" value="Reset" /&gt;
                      &lt;/form&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
          &lt;table border=1&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;Item Name&lt;/th&gt;
                      &lt;th&gt;Item Description&lt;/th&gt;
                      &lt;th&gt;Item Price&lt;/th&gt;
                      &lt;th&gt;Item Quantity&lt;/th&gt;
                      &lt;c:if test="${not empty user}"&gt;
                          &lt;th&gt;Action&lt;/th&gt;
                      &lt;/c:if&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
                  &lt;c:forEach items="${items}" var="items"&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;c:choose&gt;
                                  &lt;c:when test="${not empty user}"&gt;
                                      &lt;a href="UpdateItem?id=&lt;c:out value="${items.id}"/&gt;"&gt;&lt;c:out
                                              value="${items.itemName}" /&gt;&lt;/a&gt;
                                  &lt;/c:when&gt;
                                  &lt;c:otherwise&gt;
                                      &lt;c:out value="${items.itemName}" /&gt;
                                  &lt;/c:otherwise&gt;
                              &lt;/c:choose&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;c:out value="${items.itemDescription}" /&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;c:out value="${items.itemPrice}" /&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;c:out value="${items.itemQuantity}" /&gt;&lt;/td&gt;
                          &lt;c:if test="${not empty user}"&gt;
                              &lt;td&gt;
                                  &lt;form id="deleteItem&lt;c:out value="${items.id}"/&gt;" method="POST"
                                      action="DeleteItem"&gt;
                                      &lt;input type="hidden" id="id" name="id"
                                          value="&lt;c:out value="${items.id}"/&gt;" /&gt; &lt;input type="submit"
                                          value="Delete"
                                          onclick="return confirm('Are you sure to delete this item?')" /&gt;
                                  &lt;/form&gt;
                              &lt;/td&gt;
                          &lt;/c:if&gt;
                      &lt;/tr&gt;
                  &lt;/c:forEach&gt;
              &lt;/tbody&gt;
          &lt;/table&gt;
  
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>and when the item name is clicked, I have another jsp file which is >itemUpdate.jsp:</p>
  
  <pre><code>    &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
          pageEncoding="ISO-8859-1"%&gt;
      &lt;%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
      &lt;!DOCTYPE html&gt;
      &lt;html&gt;
      &lt;head&gt;
      &lt;%@ include file="/pages/commons/scripts.jsp"%&gt;
      &lt;title&gt;Pabebe Inventory Store&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form action="UpdateItem" method="POST"&gt;
              &lt;table align="center" width="400px"&gt;
  
                  &lt;tr&gt;
                      &lt;td&gt;Item name&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" id="itemname" name="itemname"
                          value="&lt;c:out value="${itemname}"/&gt;" /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;c:out value="${usernameerrmsg}" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Item description&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" id="itemdescription"
                          name="itemdescription" value="&lt;c:out value="${itemdescription}"/&gt;" /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;c:out value="${usernameerrmsg}" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Item price&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" id="itemprice" name="itemprice"
                          value="&lt;c:out value="${itemprice}"/&gt;" /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;c:out value="${usernameerrmsg}" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
  
                  &lt;tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Item quantity&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" id="itemquantity" name="itemquantity"
                          value="&lt;c:out value="${itemquantity}"/&gt;" /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;c:out value="${usernameerrmsg}" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td colspan="3" align="center"&gt;&lt;input type="submit"
                          value="Submit" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
  
          &lt;/form&gt;
          &lt;a href="ItemList"&gt;Go to item list&lt;/a&gt;
  
  
  
  
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>SO my question is, how do I display the current value of the clicked item in >the input text in itemUpdate.jsp? And when I changed the texts and clicked >submit button, the value in the database will still update. BTW, my update is >working properly. I just wanted to show the current value in the text box when >I'm going to update a specific item.</p>
  
  <blockquote>
    <p><a href="http://i.stack.imgur.com/MPtm4.png" rel="nofollow">This is what I wanted to happen.</a></p>
  </blockquote>