Announcement Announcement Module
Collapse
No announcement yet.
Display editable data in JSP with <textarea> Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Display editable data in JSP with <textarea>

    Hi All,

    I have question about display current data in <textarea> tag in JSP.

    1. I have JSP page which has <textarea> for display editable data my jsp like....
    <td><textarea id="requestDescription" name="requestDescription" ></textarea></td>

    2. I need to put mapping value like ${csrDeficiency.requestSubmitted} inside that <textarea>....</textarea> to display current data from database.

    3. I am looking for systax which I can display as a default value.

    4. Have tried "value" but did not work

    Thank you,

  • #2
    Hello

    You are loading such jsp page from a controller, right?
    Did you populate/fill some form object (POJO) or model attribute?

    4. Have tried "value" but did not work
    If my mind doesnt fail me, a textarea has no the value attribute

    post more code to have a better idea

    Comment


    • #3
      Yes, I am loading from controller.

      I am not using pojo.

      My hold jsp is like

      <%@ taglib uri="urn:jsptagdir:/WEB-INF/tags/custom" prefix="op" %>
      <%@ taglib uri="http://java.sun.com/JSP/Page" prefix="jsp" %>
      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

      <%@ page
      import="gov.usps.fssp.util.Lookups,gov.usps.fssp.u til.*
      ,java.util.*,org.springframework.context.*
      ,org.springframework.web.servlet.support.*;"
      %>

      <form method="post" name="csrShowForm" id="csrShowForm" action="update">
      <input type="hidden" name="deferredMaintenanceId" id="deferredMaintenanceId" value="${ csrDeficiency.deferredMaintenanceId }">

      <table>
      <tr>
      <td>${csrDeficiency.property.propertyId}</td>
      <td>${csrDeficiency.property.poName}</td>
      <td>${csrDeficiency.property.unitName}</td>
      <td>${csrDeficiency.property.zip.district.name}</td>
      </tr>
      <tr>
      <td>${csrDeficiency.property.ownLease}</td>
      <td>${csrDeficiency.property.address}</td>
      <td>${csrDeficiency.property.city}</td>
      <td>${csrDeficiency.property.county}</td>
      <td>${csrDeficiency.property.state}</td>
      <td>${csrDeficiency.property.zipCode}</td>
      </tr>
      <tr>
      <td>${csrDeficiency.property.zip.district.area}</td>
      </tr>

      </table>


      <table>
      <tr>
      <td>Submitted Date</td>
      <td>${csrDeficiency.requestSubmitted}</td></td>
      </tr>
      <tr>
      <td>Request Type</td>
      <td>${csrDeficiency.requestType}</td>
      </tr>
      <tr>
      <td>
      Evaluator
      </td>

      <td colspan=3>
      <op:Rolodex name="requestEvaluatorUserId" defaultSelectedValue="${csrDeficiency.requestEvalu atorUserId}" />
      </td>
      </tr>

      <tr>
      <td>FY</td>
      <td>
      <select name="planningFy" id="planningFy">
      <c:forEach var="fy" items="${fys}">
      <option value ="${fy}"
      <c:choose>
      <c:when test="${csrDeficiency.planningFy != null && fy == csrDeficiency.planningFy}">selected</c:when>
      <c:otherwise>
      <c:if test="${ fy == currentFy}">selected</c:if>
      </c:otherwise>

      </c:choose>>${fy}</option>
      </c:forEach>
      </select>
      </td>
      </tr>
      <tr>
      <td>Budget Line</td>
      <td>
      <op:ListToOptions name="budgetLine" optionsMap="${ budgetLines }" hasFirstBlankOption="true" />
      </td>
      </tr>
      <tr>
      <td>Estimate</td>
      <td><input type="text" id="costEstimate" name="costEstimate"/></td>
      </tr>
      <tr>
      <td>Category</td>
      <td>
      <op:ListToOptions name="category" optionsMap="${ workCat }" hasFirstBlankOption="true" />
      </td>
      </tr>
      <tr>
      <td>Start Date</td>
      <td><opatePicker name="requestSubmitted" /></td>
      </tr>
      <tr>
      <td>FSSP Reference</td>
      <td>${csrDeficiency.fsspReference}</td>
      </tr>
      <tr>
      <td>ICAM Reference</td>
      <td>${csrDeficiency.lmiCallFid}</td>
      </tr>
      <tr>
      <td>Description</td>
      <td><textarea id="requestDescription" name="requestDescription" ></textarea></td>

      </tr>



      <tr>
      <td>Deficiency Photos</td>
      <td>????</td>
      </tr>

      <tr>
      <td align="center"><input type="submit" id="submitDef" name="submitDef" value="Submit"/></td>

      </tr>

      </table>
      </form>

      >>>>>>>>>>>>>>>>>>>>>>>>>>>>>

      The "Description" will be the one that i talk about.

      I can pull all data out expect the "Description"

      My controller (get) is like.

      >>>>>>>>>>>>>>>>>>>>>>>>>>>

      @RequestMapping(value = "/csr/deficiency/{id}", method = RequestMethod.GET)
      public ModelAndView showDeficiencyDetails(@PathVariable("id") String id, Map<String, Object> map, HttpServletRequest request) {
      String userArea = CookieUtil.getCookieValue(request.getCookies(), "userArea");
      System.out.println("**********showDeficiencyDetail s");
      DeferredMaintenance obj = deferredMaintenanceService.findDeferredmaintenance ById(DataUtil.stringToLong(id));
      System.out.println("-------------XZY---------------------- return obj"+ obj.getRequestDescription());
      map.put("csrDeficiency", obj);
      map.put("userArea", userArea);
      map.put("fys", deferredMaintenanceService.getFys());
      map.put("currentFy", fyDate.getFy());
      map.put("budgetLines", lookups.getBudgetLines());
      map.put("areas", lookups.getActiveOffices());
      map.put("workCat", lookups.getWorkCategories());

      return new ModelAndView("deferredmaintenances/csr/deficiency", map);
      }

      >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

      I am using DAO generic method for both "read" and "update".



      thank you for your help.

      Comment


      • #4
        It's simple, just put:

        <td><textarea id="requestDescription" name="requestDescription" >${csrDeficiency.requestDescription}</textarea></td>

        The "value" of the textarea needs to be put between the textarea start and end tags.

        In case you later want to display the value in another place (NOT inside a textarea), then see the solution here: http://www.coderanch.com/t/545580/JS...JSP-page-value

        Comment

        Working...
        X