首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

jsp 页面 展示,table内容无法显示出来

2013-01-22 
jsp 页面 显示,table内容无法显示出来。源码如下: div class content-box styleheight: 816px div

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

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

热点排行