我想做一个页面显示从数据库中查询出的数据;
但是页面什么也没有显示......
以下是我的代码: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>

解决方案 »

  1.   

    <html:form action="nopassmain.do" method="GET"> 改为
    <html:form action="/nopassmain" method="GET"> 
      

  2.   

    另外return mapping.findForward("path"); 这里的"path"我并没有在你的struts.xml中看到有对它的配置定义
      

  3.   

    再另外
    <forward name="get" path="/nopassmain.do"> </forward> 这里的"get",我猜你是认为页面中的Form中的Method="GET"对应的?????
    如果你是这样认为的话,那...
    偶建议你再看看书
      

  4.   

    不是,我知道get是用作mapping的我疏忽了我刚学struts的。
    我已经把get改成path了 可是问题依旧呵呵。。
      

  5.   

    刚开始学struts,都是自学很多地方还是不大清楚
      

  6.   

    刚开始学struts,都是自学,还有很多地方不是很清楚。希望numen_wlm 多多指教。谢谢啊。。