jsp 页面 显示,table内容无法显示出来。
源码如下:
<div class = content-box style="height: 816px; ">
<div class="result-list">
<table width="60%" id="product-table">
<tr>
<th width="6%">角色ID</th><th width="6%">账号ID</th><th width="6%">角色名</th><th width="6%">等级</th>
</tr>
<% if(RoleList!=null){
for(Role role:RoleList){
int id = role.getAccountId();
String name = role.getName();
System.out.println("wo are in circle,and the name is "+ name);
%>
<tr>
[align=left] <td><%="name"%><td>
<td><%="name"%><td>
<td><%=name%><td>
<td><%=name%><td>
</tr>
<%
}
}
%>[/align]
</table></div>
</div>
在jsp页面控制台可以输出:
wo are in circle,and the name is laofan11
wo are in circle,and the name is laofan1
但是为什么表格中什么都不显示呢.... jsp table div
[解决办法]
写法真心没问题。那你把这些html的代码页都放在java代码里
<% if(RoleList!=null){
for(Role role:RoleList){
int id = role.getAccountId();
String name = role.getName();
System.out.println("wo are in circle,and the name is "+ name);
out.print("<tr><td>"+name+"</td><td>"+name+"</td><tr>");
}
}
%>
用这种的看看把
[解决办法]
<% if(RoleList!=null){
for(Role role:RoleList){
int id = role.getAccountId();
String name = role.getName();
System.out.println("wo are in circle,and the name is "+ name);
%>
<tr> <td><%=role.getName()%><td> <td><%="name"%><td>
<td><%=name%><td>
<td><%=name%><td>
</tr>
<%
}
}
%>