【发布时间】:2013-01-06 16:22:36
【问题描述】:
在我的 JSP 页面中,我在数据库中显示员工详细信息并以硬编码的形式给出表列名。现在我需要知道如何动态获取表列名?
我知道 ResultSetMetaData 只能在 JSP 中使用。但是我不知道在JSP中使用Spring-Hibernate集成时如何获取列名。
请任何人帮忙解决这个问题?
我的 JSP 页面将是,
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ include file="include.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form:form action="displayuser.html" commandName="displayuser">
<table width="100%" align="center">
<tr style="background-color:#6B8E23 ;">
<td align="center">Employee Id</td>
<td align="center">Employee Name</td>
<td align="center">Employee Password</td>
<td align="center">Gender</td>
<td align="center">Designation</td>
</tr>
<core:forEach items="${DisplayuserDetail}" var="userObj">
<tr style="background-color:#9ACD32 ;">
<td align="center"><core:out value="${userObj.empId}"/></td>
<td align="center"><core:out value="${userObj.empName}"/></td>
<td align="center"><core:out value="${userObj.empPassword}"/></td>
<td align="center"><core:out value="${userObj.gender}"/></td>
<td align="center"><core:out value="${userObj.designation}"/></td>
</tr>
</core:forEach>
</table>
</form:form>
</body>
</html>
提前致谢...我们将不胜感激您的帮助...
【问题讨论】:
标签: spring hibernate jsp spring-mvc