java:根据条件隐藏或显示表
我有一个带有一些输入的表单;每个输入返回一个数据列表,该列表显示在另一个html页面的表中。每个输入都有一个表来显示其数据。我的任务是,如果用户未输入数据,则不显示数据 这是我的密码java:根据条件隐藏或显示表,java,html,jsp,Java,Html,Jsp,我有一个带有一些输入的表单;每个输入返回一个数据列表,该列表显示在另一个html页面的表中。每个输入都有一个表来显示其数据。我的任务是,如果用户未输入数据,则不显示数据 这是我的密码 <!-- Country Table--> <%for(int i = 0; i < countryList.length;i++){ if(countryList.length == 0)
<!-- Country Table-->
<%for(int i = 0; i < countryList.length;i++){
if(countryList.length == 0)
break;
%>
<div class="box" align="center">
<table name="tab" align="center" class="gridtable">
<thead >
<tr>
<th style="width: 50%" scope="col">Entity Watch List Key</th>
<th style="width: 50%" scope="col">Watch List Name</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 50%"><%out.println((String) (countryList[i].getEntityWatchListKey()));%></td>
<td style="width: 50%"><%out.println((String) (countryList[i].getEntityName()));%></td>
</tr>
</tbody>
</table>
</div>
<%}%>
实体监视列表键
观察名单名称
我正在使用break退出循环以不显示表,是这样吗?您可以在for循环之前使用此条件
if(countryList.length != 0)
或
然后你不需要使用中断条件
此外,您当前定义的for循环将不起作用,因为如果数组的长度为0,则此条件i
if(countryList.length != 0)
或
然后你不需要使用中断条件
此外,您当前定义的for循环将不起作用,因为如果数组的长度为0,则此条件i
<div class="box" align="center">
<table name="tab" align="center" class="gridtable">
<thead >
<tr>
<th style="width: 50%" scope="col">Entity Watch List Key</th>
<th style="width: 50%" scope="col">Watch List Name</th>
</tr>
</thead>
<tbody>
<%for(int i = 0; i < countryList.length;i++){
if(countryList.length > 0) %>
<tr>
<td style="width: 50%"><%out.println((String) (countryList[i].getEntityWatchListKey()));%></td>
<td style="width: 50%"><%out.println((String) (countryList[i].getEntityName()));%></td>
</tr>
<%}%>
</tbody>
</table>
</div>
实体监视列表键
观察名单名称
0) %>
为了进行良好的练习,您必须重复行而不是表 请修改您的代码
<div class="box" align="center">
<table name="tab" align="center" class="gridtable">
<thead >
<tr>
<th style="width: 50%" scope="col">Entity Watch List Key</th>
<th style="width: 50%" scope="col">Watch List Name</th>
</tr>
</thead>
<tbody>
<%for(int i = 0; i < countryList.length;i++){
if(countryList.length > 0) %>
<tr>
<td style="width: 50%"><%out.println((String) (countryList[i].getEntityWatchListKey()));%></td>
<td style="width: 50%"><%out.println((String) (countryList[i].getEntityName()));%></td>
</tr>
<%}%>
</tbody>
</table>
</div>
实体监视列表键
观察名单名称
0) %>
为了进行良好的练习,您必须重复行而不是表