Sql Server查询数据库表字段名
SELECT NAME FROM SysColumns WHERE ID = OBJECT_ID('tableName')
查询并将结果存入list中
String columnName = "SELECT NAME FROM SysColumns WHERE ID = OBJECT_ID('tableName')"; List<Map<String,Object>> columnNameList = daoJdbc.findListBySql(columnName); request.setAttribute("columnNameList", columnNameList);
在jsp页面遍历输出字段名
<s:iterator value="#request.columnNameList" var="nameMap"> <s:iterator value="nameMap"> <td width="${fn:length(value)*20}">${value}</td> </s:iterator> </s:iterator>