我想从数据库中查找所有的数据!用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中的信息,直接查.
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中的信息,直接查.
解决方案 »
- Caused by: java.sql.SQLException: 不支持的特性
- flex将数据库数据以tree形式读出后,如何操作节点
- 请教大家使用servlet更新完数据后如何进行JSP页面跳转呀?
- 也不算是提问吧,只是想与大家交流交流一下
- 求权限管理Struts+Hibernate源代码
- 高手帮帮我啊,csdn上都解决不了的问题,在别处更解决不了啊.(送100分 问题解决马上结贴)
- java.lang.NoSuchFieldException: DEFAULT_PARAM如何处理
- 做了一个调查,想用饼形图显示结果,但不知道用JSP怎么绘图?
- 请问JDBC为什么比ODBC效率更低?在线等待
- 上传文件问题我没看懂,帮忙出学JSP!!!
- preparedstatement怎么拼接sql语句
- 静态页面做网站流量统计、点击数。。。。。。
中的getSession()去掉试下