高手帮忙!JSP页面查值,用EL表达式出现了问题!用的是SQL标签关键代码如下: 10
<sql:setDataSourcedriver="com.microsoft.jdbc.sqlserver.SQLServerDriver"url="jdbc:sqls...
<sql:setDataSource driver="com.microsoft.jdbc.sqlserver.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;databaseName=liuyan" var="conn"
user="****" password="******"
/>
<sql:query var="rs" dataSource="${conn}">
select top 5 txtName,txtMobilePhone,txtContext from liuyan_message
</sql:query>
<table border="1">
<tr>
<td>留言者姓名</td>
<td>联系方式</td>
<td>留言内容</td>
</tr>
<c:forEach var="row" items="${rs.rows}">
<tr>
<td>${row.txtName }</td>
<td>${row.txtMobilePhone }</td>
<td>${row.txtContext }</td>
</tr>
</c:forEach>
</table>
页面上出现的结果为:
<table border="1">
<tr>
<td>留言者姓名</td>
<td>联系方式</td>
<td>留言内容</td>
</tr>
<tr>
<td>${row.txtName }</td>
<td>${row.txtMobilePhone }</td>
<td>${row.txtContext }</td>
</tr>
<tr>
<td>${row.txtName }</td>
<td>${row.txtMobilePhone }</td>
<td>${row.txtContext }</td>
</tr>
<tr>
<td>${row.txtName }</td>
<td>${row.txtMobilePhone }</td>
<td>${row.txtContext }</td>
</tr>
<tr>
<td>${row.txtName }</td>
<td>${row.txtMobilePhone }</td>
<td>${row.txtContext }</td>
</tr>
<tr>
<td>${row.txtName }</td>
<td>${row.txtMobilePhone }</td>
<td>${row.txtContext }</td>
</tr>
</table>
也就是说,已经查出多少条记录了,就是EL表达式有问题,怎么试都没用!高手帮帮忙! 展开
url="jdbc:sqlserver://localhost:1433;databaseName=liuyan" var="conn"
user="****" password="******"
/>
<sql:query var="rs" dataSource="${conn}">
select top 5 txtName,txtMobilePhone,txtContext from liuyan_message
</sql:query>
<table border="1">
<tr>
<td>留言者姓名</td>
<td>联系方式</td>
<td>留言内容</td>
</tr>
<c:forEach var="row" items="${rs.rows}">
<tr>
<td>${row.txtName }</td>
<td>${row.txtMobilePhone }</td>
<td>${row.txtContext }</td>
</tr>
</c:forEach>
</table>
页面上出现的结果为:
<table border="1">
<tr>
<td>留言者姓名</td>
<td>联系方式</td>
<td>留言内容</td>
</tr>
<tr>
<td>${row.txtName }</td>
<td>${row.txtMobilePhone }</td>
<td>${row.txtContext }</td>
</tr>
<tr>
<td>${row.txtName }</td>
<td>${row.txtMobilePhone }</td>
<td>${row.txtContext }</td>
</tr>
<tr>
<td>${row.txtName }</td>
<td>${row.txtMobilePhone }</td>
<td>${row.txtContext }</td>
</tr>
<tr>
<td>${row.txtName }</td>
<td>${row.txtMobilePhone }</td>
<td>${row.txtContext }</td>
</tr>
<tr>
<td>${row.txtName }</td>
<td>${row.txtMobilePhone }</td>
<td>${row.txtContext }</td>
</tr>
</table>
也就是说,已经查出多少条记录了,就是EL表达式有问题,怎么试都没用!高手帮帮忙! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询