0
<sql:query var="TableRow" dataSource="jdbc/db">
   SELECT * from table1;
</sql:query>

How to display the names of columns in table1 table? I know how to access the individual rows using Tablerow.rowsByIndex, but don't know how to display the column names themselves.

xxx374562
  • 226
  • 1
  • 8
  • Possible duplicate of [How to access duplicate column names with JSTL sql:query?](https://stackoverflow.com/questions/14431907/how-to-access-duplicate-column-names-with-jstl-sqlquery) – yash Oct 02 '18 at 15:42

1 Answers1

1
<sql:query sql="SELECT * from table1" var="TableRow" dataSource="jdbc/db">
 <c:forEach var="colName" items=${TableRow.columnsNames}>
    ${colName}
 </c:forEach>
</sql:query> 

Move sql query into attribute, and have a loop for columnsName on query result

Yang Daniel
  • 125
  • 5