我如何显示或检索整个桌子(对于Struts和Weblogic and Servlet)?
我是支柱和博客的新手。我制作了一个示例代码,并且无法继续前进,因为我无法得到想要的结果。
该代码应该很简单:检索数据库中的所有记录并将其显示在Web浏览器上。
db table < - 表名是loc_log
my .jsp(main_log.jsp)
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>main_log</title>
</head>
<body>
<table border = '1'>
<tr>
<th>Name</th>
<th>Remarks</th>
</tr>
<s:iterator value ="locatorEntity_list">
<tr>
<td class="eename" align="center" style="font-weight:bold">
<s:property value="eename" ></s:property>
</td>
<td align="center" style="font-weight:bold">
<s:property value="remarks"></s:property>
</td>
</s:iterator>
</table>
</body>
</html>
显然,该代码不会进入迭代器内部,仅将其作为a 结果
我有一个推断出问题可能是在我的行动方法中,但我不知道问题本身是什么。我希望任何人都可以帮助我..
病还包括我的动作方法中的内容
private String eename;
private String remarks;
private List<locatorEntity> locatorEntity_list;
public String retrieve_logdata(){
locatorEntity logs = new locatorEntity();
logs.setEename(this.getEename());
logs.setRemarks(this.getRemarks());
List<locatorEntity> locatorEntity_list = locatorDAOFacade.qry_getLog(logs);
Iterator<locatorEntity> lon_itr = locatorEntity_list.iterator();
List<locatorEntity> temp_list = new ArrayList<locatorEntity>();
while(lon_itr.hasNext()){
locatorEntity inside_while = new locatorEntity();
inside_while = lon_itr.next();
inside_while.setEename(logs.getEename());
inside_while.setRemarks(logs.getRemarks());
temp_list.add(inside_while);
}
this.setLocatorEntity_list(temp_list);
return SUCCESS;
}
qry_getlog
<resultMap id = "qry_getLogMap" class = "entity.locatorEntity">
<result property="eename" column="EENAME" />
<result property="remarks" column="REMARKS" />
</resultMap>
<select id="qry_getLog" resultMap="qry_getLogMap" parameterClass="entity.locatorEntity">
SELECT
EENAME,
REMARKS
FROM
LOC_LOG
</select>
im new to struts and weblogic. i made a sample code, and cant move on cause i cant get the result that i wanted.
The code should be just simple: retrieve all records in the database and display it on the web browser.
The DB table <-- Table name is LOC_LOG
my .jsp (main_log.jsp)
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>main_log</title>
</head>
<body>
<table border = '1'>
<tr>
<th>Name</th>
<th>Remarks</th>
</tr>
<s:iterator value ="locatorEntity_list">
<tr>
<td class="eename" align="center" style="font-weight:bold">
<s:property value="eename" ></s:property>
</td>
<td align="center" style="font-weight:bold">
<s:property value="remarks"></s:property>
</td>
</s:iterator>
</table>
</body>
</html>
Apparently, the code doesn't go inside the iterator and only got this as a result
i have a deduction that the problem might be in my action method but i dont know what is the problem itself. i hope anyone can help me..
ill also include what is in my action method
private String eename;
private String remarks;
private List<locatorEntity> locatorEntity_list;
public String retrieve_logdata(){
locatorEntity logs = new locatorEntity();
logs.setEename(this.getEename());
logs.setRemarks(this.getRemarks());
List<locatorEntity> locatorEntity_list = locatorDAOFacade.qry_getLog(logs);
Iterator<locatorEntity> lon_itr = locatorEntity_list.iterator();
List<locatorEntity> temp_list = new ArrayList<locatorEntity>();
while(lon_itr.hasNext()){
locatorEntity inside_while = new locatorEntity();
inside_while = lon_itr.next();
inside_while.setEename(logs.getEename());
inside_while.setRemarks(logs.getRemarks());
temp_list.add(inside_while);
}
this.setLocatorEntity_list(temp_list);
return SUCCESS;
}
qry_getLog
<resultMap id = "qry_getLogMap" class = "entity.locatorEntity">
<result property="eename" column="EENAME" />
<result property="remarks" column="REMARKS" />
</resultMap>
<select id="qry_getLog" resultMap="qry_getLogMap" parameterClass="entity.locatorEntity">
SELECT
EENAME,
REMARKS
FROM
LOC_LOG
</select>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论