Announcement Announcement Module
Collapse
No announcement yet.
Populate a table+jstl Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Populate a table+jstl

    Hi
    I want to populate an HTML table using jstl code.I am using Hasp map.For 1 column its okay it works fine.But if I am suppose to populate 2 or 3 columns from the database than I am having problem to display them.Please help
    Code:
    String tabvalue,tab1;
    java.util.HashMap map = new java.util.HashMap();
    String sQuery1 = "select * from company  where CompanyName = '" + c.getCompany_Name() + "' "                     SqlRowSet srs = tpl.queryForRowSet("select CompanyName,CompanyAddress from company");
                        int rowCount = 0;
                        while (srs.next()) {
                          map.put("tabvalue"+rowCount,srs.getString("CompanyName"));        map.put("tab1"+rowCount,srs.getString("CompanyAddress"));
                             rowCount++;
                                 }
                            request.setAttribute("map", map);
    My jstl code to populate a table is like this:
    HTML Code:
    <form:form method="POST"  action = "/companydo.htm" commandName="Company" name="x">
        <TABLE class="comonfield1" colspan="3%" align="center" width="500" bgcolor="#808080> 
               <c:forEach var='item' items='${map}'>
                <TR><TD>
                              <c:out value='Key=${item.key}, Value=${item.value}'/>
                </TD>
                    <TD>
                    <c:out value='Key=${item.key}, Value=${item.value}'/>
                </TD>
                </TR>
            </c:forEach>
                </TABLE>
    </form:form>

  • #2
    On the face of it, this does not appear to be a dm Server specific issue. In that case, you are more likely to get an answer on another forum.

    Comment

    Working...
    X