我想从数据库中查找所有的数据!用struts
jsp<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic"%>
<html>
<head>
<title>JSP for SuccessForm form</title>
</head>
<body>
<html:form action="/find">username : <html:select property="username">
<html:option value="全部">全部</html:option>
<html:option value="姓名">姓名</html:option>
</html:select>
<html:text property="key"/>
<br/>
<html:submit/>
</html:form>
<logic:present name="list">
<logic:iterate id="plist" name="list">
<table>
<tr>
<td>
<bean:write name="plist" property="id"/>
</td>
<td>
<bean:write name="plist" property="filesname"/>
</td>
<td>
<bean:write name="plist" property="filessize"/>
</td>
<td>
<html:link action="/find" paramId="iid" paramName="plist" paramProperty="id">下载</html:link>
</td>
</tr>
</table>
</logic:iterate></logic:present>
</body>
</html>
问题补充:form中public class SuccessForm extends ActionForm {
private String key;
private String username;public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
return null;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}public String getUsername() {
return username;
}public void setUsername(String username) {
this.username = username;
}
}
action中 public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
SuccessForm successForm = (SuccessForm) form;String username=successForm.getUsername();filesDAO dao=new filesDAO();List list=dao.findall(); request.getSession().setAttribute("list", list);
return mapping.findForward("success");
}}action中我不用jsp中的信息,直接查.