【发布时间】:2015-12-15 14:47:27
【问题描述】:
如何拆分 JSP 的数组值,我正在尝试拆分数组值并放入表中
<%
String query = request.getParameter("item");
ItemSearch is = new ItemSearch();
ArrayList<Items> result = is.doSearch(query);
for(Items item : result)
{
out.println(item.getImg());
out.println(item.getHref());
out.println(item.getTitle());
out.println(item.getPrice());
out.println(item.getDesc());
//out.println(item.toString());
}
%>
这是我的桌子。
<table border="1">
<thead>
<tr>
<th>Description</th>
<th>Name</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= out.println(item.getDesc)%></td>
<td></td>
<td></td>
</tr>
任何人都可以帮助我进行此编码。我如何称呼每个项目
【问题讨论】:
-
在打印语句中打印您的 html
-
你写了你想要拆分值,你是在谈论循环你的
item数组以连续显示每个项目吗? -
@jhamon 是的,我在谈论循环以及如何在表格中显示