日期:2014-05-17  浏览次数:20634 次

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>              
 <%
 }
 }
 %>

这样呢
------解决方案--------------------
你试试把脚本都去掉。单独就打印出表格。之后再一点一点添加脚本。这样问题容易找。也不费力。