100分 求一个Struts的 查询例子 (简单点的) 100分 求一个Struts的 查询例子 (简单点的) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 告诉我你的email,我发个给你罗 [email protected] 我要,谢谢. struts-config.xml.............. <action path="/searchdate" type="com.xxx.SearchAction" name="SearchForm" scope="request"> <forward name="success" path="/list.jsp"/> </action> package com.xxx;public class SearchAction extends Action{ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res ){ ListBean lb =new ListBean(); /*读取form,以参数传给处理方法 返回结果集*/ ArrayList slist= lb.getList((SearchForm)form); /*将结果集存放到request中*/ req.setAttribute("myList",slist); ActionForward forward= new ActionForward(); forward=mapping.findForward("success"); return forward; }}SearchForm.java...........public class SearchForm extends ActionForm { private String type; private String date; public String getType(){ return type; } public void setType(String args){ this.type=args } public String getDate(){ return date; } public void setDate(String args){ this.date=args }}list.jsp<html:form action="/searchdate.do"> <html:text property="type"/> <html:text property="date"/></html:form><!--遍历结果--><logic:iterate id="test" name="myList" scope="request"> <bean:write name="test" property="xb"/> <bean:write name="test" property="age"/></logic:iterate>Test.javapublic class Test{ private String xb; private String age; public String getXb(){ return xb; } public void setXb(String args){ this.xb=args } public String getAge(){ return Age; } public void setAge(String args){ this.age=args }}你自己改一下,其中具体的查询方法自己ListBean写就可以了 TO zhaochunhui(没有烟抽的日子@事不过三,过三重构) :你给他写的STRUTS-CONFIG.XML文件中没写SearchForm的配置..... 新手上路,关于多线程共享数据的问题 java的进程如何销毁 一个java的随机数 求助javascript高手 java.lang.NullPointerException imp命令在java中调用的问题 求助~~ java中开根号的函数是什么? 在dos下运行时能提供整数参数吗? 请教:我想选个WEB APPLICATION SERVER,请问什么比较好?重谢 解二元二次方程组问题,急!! java实现队列,帮忙看下
..............
<action path="/searchdate"
type="com.xxx.SearchAction"
name="SearchForm"
scope="request">
<forward name="success"
path="/list.jsp"/>
</action>
package com.xxx;
public class SearchAction extends Action{
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res
){ ListBean lb =new ListBean();
/*读取form,以参数传给处理方法 返回结果集*/
ArrayList slist= lb.getList((SearchForm)form);
/*将结果集存放到request中*/
req.setAttribute("myList",slist);
ActionForward forward= new ActionForward();
forward=mapping.findForward("success");
return forward;
}}
SearchForm.java
...........
public class SearchForm extends ActionForm {
private String type;
private String date;
public String getType(){
return type;
}
public void setType(String args){
this.type=args
}
public String getDate(){
return date;
}
public void setDate(String args){
this.date=args
}}
list.jsp
<html:form action="/searchdate.do">
<html:text property="type"/>
<html:text property="date"/>
</html:form>
<!--遍历结果-->
<logic:iterate id="test" name="myList" scope="request">
<bean:write name="test" property="xb"/>
<bean:write name="test" property="age"/>
</logic:iterate>Test.java
public class Test{
private String xb;
private String age;
public String getXb(){
return xb;
}
public void setXb(String args){
this.xb=args
}
public String getAge(){
return Age;
}
public void setAge(String args){
this.age=args
}
}你自己改一下,其中具体的查询方法自己ListBean写就可以了