我想做一个页面显示从数据库中查询出的数据;
但是页面什么也没有显示......
以下是我的代码:bean:
package com.startech.struts.bean;public class NopassmainBean {
private String CBTYPE; private String CLEAVPORT; private String CNATION; private String CSEX; private String CCOUNTRY; private String CLEAVRESN; private String CHNNAME; public String getCBTYPE() {
return CBTYPE;
} public void setCBTYPE(String CBTYPE) {
this.CBTYPE = CBTYPE;
} public String getCLEAVPORT() {
return CLEAVPORT;
} public void setCLEAVPORT(String CLEAVPORT) {
this.CLEAVPORT = CLEAVPORT;
} public String getCNATION() {
return CNATION;
} public void setCNATION(String CNATION) {
this.CNATION = CNATION;
} public String getCSEX() {
return CSEX;
} public void setCSEX(String CSEX) {
this.CSEX = CSEX;
} public String getCCOUNTRY() {
return CCOUNTRY;
} public void setCCOUNTRY(String CCOUNTRY) {
this.CCOUNTRY = CCOUNTRY;
} public String getCLEAVRESN() {
return CLEAVRESN;
} public void setCLEAVRESN(String CLEAVRESN) {
this.CLEAVRESN = CLEAVRESN;
} public String getCHNNAME() {
return CHNNAME;
} public void setCHNNAME(String CHNNAME) {
this.CHNNAME = CHNNAME;
}
}
form:
public class NopassmainForm extends ActionForm { private ArrayList list;
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
ActionErrors errors=new ActionErrors();
errors.add("Error:", new ActionError("null"));
return errors;
} public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
} public ArrayList getList() {
return list;
} public void setList(ArrayList list) {
this.list = list;
}}
action:public class NopassmainActions extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
NopassmainForm nopassmainForm = (NopassmainForm) form;// TODO Auto-generated method stub
nopassComponent com = new nopassComponent();
List loadlist = com.nopasscomponent("350000");
List inlist = new ArrayList();
ArrayList alist=new ArrayList();
NopassmainBean npmb = new NopassmainBean();
for(int i=0;i<10;i++)
{
inlist = (ArrayList)loadlist.get(i);
npmb.setCHNNAME("1");
npmb.setCSEX("1");
npmb.setCNATION("1");
npmb.setCBTYPE("1");
npmb.setCCOUNTRY("1");
npmb.setCLEAVRESN("1");
npmb.setCLEAVPORT("1");
/*npmb.setCHNNAME(inlist.get(0).toString());
npmb.setCSEX(inlist.get(1).toString());
npmb.setCNATION(inlist.get(2).toString());
npmb.setCBTYPE(inlist.get(3).toString());
npmb.setCCOUNTRY(inlist.get(4).toString());
npmb.setCLEAVRESN(inlist.get(5).toString());
npmb.setCLEAVPORT(inlist.get(6).toString());*/
alist.add(npmb);
}
nopassmainForm.setList(alist);
//request.setAttribute("list", sendlist);
return mapping.findForward("path");
}
/*public static void main(String[] ag)
{
NopassmainActions na = new NopassmainActions();
}*/
}
jsp页面:<%@ page language="java" contentType="text/html;charset=gb2312" pageEncoding="GB2312"%>
<html:html lang="true">
<head> <title>本地区级别未发证人员名单</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<meta http-equiv="refresh" content="50">
</head><body>
<div>
<html:form action="nopassmain.do" method="GET">
<table align="center">
<tr>
<td align="center">
本地区级别未发证人员名单
</td>
</tr>
<tr>
<td align=center>
<table>
<tr>
<td width=80 align=center>姓名
</td>
<td width=80 align=center>性别
</td>
<td width=80 align=center>名族
</td>
<td width=80 align=center>业务类型
</td>
<td width=80 align=center>前往地
</td>
<td width=80 align=center>出境事由
</td>
<td width=80 align=center>出境口岸
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<html:submit/><html:cancel/>
</td>
</tr>
<tr>
<td align="center">
<logic:iterate name="NopassmainForm" id="npmb" property="list" indexid="10">
<table>
<tr>
<td width=80 align=center><bean:write name="npmb" property="CHNNAME"/></td>
<td width=80 align=center><bean:write name="npmb" property="CSEX"/></td>
<td width=80 align=center><bean:write name="npmb" property="CNATION"/></td>
<td width=80 align=center><bean:write name="npmb" property="CBTYPE"/></td>
<td width=80 align=center><bean:write name="npmb" property="CCOUNTRY"/></td>
<td width=80 align=center><bean:write name="npmb" property="CLEAVRESN"/></td>
<td width=80 align=center><bean:write name="npmb" property="CLEAVPORT"/></td>
</tr>
</table>
</logic:iterate>
</td>
</tr>
<tr>
<td align=center>
<div class="foot" >
<br>
<SPAN class=copyright> </SPAN></div>
</td>
</tr>
</table>
</html:form>
</div>
</body>
</html:html>
struts-config.xml:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"><struts-config>
<data-sources />
<form-beans >
<form-bean name="nopassmainForm" type="com.startech.struts.form.NopassmainForm">
</form-bean> </form-beans> <global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="nopassmainForm"
input="/nopassmain.jsp"
name="nopassmainForm"
path="/nopassmain"
scope="request"
type="com.startech.struts.action.NopassmainActions" >
<forward name="get" path="/nopassmain.do"></forward>
</action> </action-mappings> <message-resources parameter="com.startech.struts.ApplicationResources" />
</struts-config>
但是页面什么也没有显示......
以下是我的代码:bean:
package com.startech.struts.bean;public class NopassmainBean {
private String CBTYPE; private String CLEAVPORT; private String CNATION; private String CSEX; private String CCOUNTRY; private String CLEAVRESN; private String CHNNAME; public String getCBTYPE() {
return CBTYPE;
} public void setCBTYPE(String CBTYPE) {
this.CBTYPE = CBTYPE;
} public String getCLEAVPORT() {
return CLEAVPORT;
} public void setCLEAVPORT(String CLEAVPORT) {
this.CLEAVPORT = CLEAVPORT;
} public String getCNATION() {
return CNATION;
} public void setCNATION(String CNATION) {
this.CNATION = CNATION;
} public String getCSEX() {
return CSEX;
} public void setCSEX(String CSEX) {
this.CSEX = CSEX;
} public String getCCOUNTRY() {
return CCOUNTRY;
} public void setCCOUNTRY(String CCOUNTRY) {
this.CCOUNTRY = CCOUNTRY;
} public String getCLEAVRESN() {
return CLEAVRESN;
} public void setCLEAVRESN(String CLEAVRESN) {
this.CLEAVRESN = CLEAVRESN;
} public String getCHNNAME() {
return CHNNAME;
} public void setCHNNAME(String CHNNAME) {
this.CHNNAME = CHNNAME;
}
}
form:
public class NopassmainForm extends ActionForm { private ArrayList list;
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
ActionErrors errors=new ActionErrors();
errors.add("Error:", new ActionError("null"));
return errors;
} public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
} public ArrayList getList() {
return list;
} public void setList(ArrayList list) {
this.list = list;
}}
action:public class NopassmainActions extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
NopassmainForm nopassmainForm = (NopassmainForm) form;// TODO Auto-generated method stub
nopassComponent com = new nopassComponent();
List loadlist = com.nopasscomponent("350000");
List inlist = new ArrayList();
ArrayList alist=new ArrayList();
NopassmainBean npmb = new NopassmainBean();
for(int i=0;i<10;i++)
{
inlist = (ArrayList)loadlist.get(i);
npmb.setCHNNAME("1");
npmb.setCSEX("1");
npmb.setCNATION("1");
npmb.setCBTYPE("1");
npmb.setCCOUNTRY("1");
npmb.setCLEAVRESN("1");
npmb.setCLEAVPORT("1");
/*npmb.setCHNNAME(inlist.get(0).toString());
npmb.setCSEX(inlist.get(1).toString());
npmb.setCNATION(inlist.get(2).toString());
npmb.setCBTYPE(inlist.get(3).toString());
npmb.setCCOUNTRY(inlist.get(4).toString());
npmb.setCLEAVRESN(inlist.get(5).toString());
npmb.setCLEAVPORT(inlist.get(6).toString());*/
alist.add(npmb);
}
nopassmainForm.setList(alist);
//request.setAttribute("list", sendlist);
return mapping.findForward("path");
}
/*public static void main(String[] ag)
{
NopassmainActions na = new NopassmainActions();
}*/
}
jsp页面:<%@ page language="java" contentType="text/html;charset=gb2312" pageEncoding="GB2312"%>
<html:html lang="true">
<head> <title>本地区级别未发证人员名单</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<meta http-equiv="refresh" content="50">
</head><body>
<div>
<html:form action="nopassmain.do" method="GET">
<table align="center">
<tr>
<td align="center">
本地区级别未发证人员名单
</td>
</tr>
<tr>
<td align=center>
<table>
<tr>
<td width=80 align=center>姓名
</td>
<td width=80 align=center>性别
</td>
<td width=80 align=center>名族
</td>
<td width=80 align=center>业务类型
</td>
<td width=80 align=center>前往地
</td>
<td width=80 align=center>出境事由
</td>
<td width=80 align=center>出境口岸
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<html:submit/><html:cancel/>
</td>
</tr>
<tr>
<td align="center">
<logic:iterate name="NopassmainForm" id="npmb" property="list" indexid="10">
<table>
<tr>
<td width=80 align=center><bean:write name="npmb" property="CHNNAME"/></td>
<td width=80 align=center><bean:write name="npmb" property="CSEX"/></td>
<td width=80 align=center><bean:write name="npmb" property="CNATION"/></td>
<td width=80 align=center><bean:write name="npmb" property="CBTYPE"/></td>
<td width=80 align=center><bean:write name="npmb" property="CCOUNTRY"/></td>
<td width=80 align=center><bean:write name="npmb" property="CLEAVRESN"/></td>
<td width=80 align=center><bean:write name="npmb" property="CLEAVPORT"/></td>
</tr>
</table>
</logic:iterate>
</td>
</tr>
<tr>
<td align=center>
<div class="foot" >
<br>
<SPAN class=copyright> </SPAN></div>
</td>
</tr>
</table>
</html:form>
</div>
</body>
</html:html>
struts-config.xml:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"><struts-config>
<data-sources />
<form-beans >
<form-bean name="nopassmainForm" type="com.startech.struts.form.NopassmainForm">
</form-bean> </form-beans> <global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="nopassmainForm"
input="/nopassmain.jsp"
name="nopassmainForm"
path="/nopassmain"
scope="request"
type="com.startech.struts.action.NopassmainActions" >
<forward name="get" path="/nopassmain.do"></forward>
</action> </action-mappings> <message-resources parameter="com.startech.struts.ApplicationResources" />
</struts-config>
解决方案 »
- 请问JavaEE中当Session超时之后,服务器如何处理?
- 项目中hibernate插入数据问题
- enctype="multipart/form-data"的问题
- java里面有没有现成的MD5加密类?
- axis2和Sring3.0集成出现以下问题
- 江湖救急,Weblogic8.14+JBuilderX+SQL Server2000配置数据源的问题。
- 一个假期都没找到关于tomcat性能的的解决问题。。。
- lucene怎么实现中文检索?
- 关于防止给客户的J2EE应用包被竞争对手窃取(J2EE应用如何保证软件安全)的讨论.(参与有分)
- struts的关于Action的一个问题
- 关于ANT 增加JVM内存
- Spring + hibernate +webwork 执行action 方法时运行了两遍
<html:form action="/nopassmain" method="GET">
<forward name="get" path="/nopassmain.do"> </forward> 这里的"get",我猜你是认为页面中的Form中的Method="GET"对应的?????
如果你是这样认为的话,那...
偶建议你再看看书
我已经把get改成path了 可是问题依旧呵呵。。