我也需要,我也出分300可以吗?
Email:[email protected]
[email protected]

解决方案 »

  1.   

    //JSP例子,注意LOGIC标记,使用了JAVA中的一个迭代器。
    <%@ page contentType="text/html; charset=GBK" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %><html>
    <head>
    <title>
    searchSummary
    </title>
    <script language="JavaScript">
    function OverText(obj){
        searchSummaryActionForm.reqNo.style.borderColor = '#71828A';
        searchSummaryActionForm.proposerName.style.borderColor = '#71828A';
        searchSummaryActionForm.dtStart.style.borderColor = '#71828A';
        searchSummaryActionForm.dtEnd.style.borderColor = '#71828A';    obj.focus();
        obj.select();
        obj.style.borderColor='red';
    }
    </script>
    <link href="image/MainPage.css" rel="stylesheet" type="text/css"> <!--请自己选择CSS路径-->
    </head>
    <jsp:useBean id="userinfo" scope="session" class="com.lenovo.shc.req.businesslogic.UserCheck" />
    <jsp:useBean id="condition" scope="request" class="com.lenovo.shc.req.SearchCondition" />
    <jsp:useBean id="reqSet" scope="request" class="com.lenovo.shc.req.businesslogic.SoftwareRequestSet" />
    <body bgcolor="#ffffff">
    <h1>软件需求查询</h1>
    <html:form action="searchSummaryAction.do">
      <table width="500" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="125"><font size="2">需求编号</font></td>
          <td width="125"><font size="2"><html:text styleClass="inputcss2" property="reqNo" size="18" maxlength="20" onmouseover="OverText(this);"/></font></td>
          <td width="125"><font size="2">提交人姓名</font></td>
          <td width="125"><font size="2"><html:text styleClass="inputcss2" property="proposerName" size="18" maxlength="20" onmouseover="OverText(this);"/></font></td>
        </tr>
        <tr>
          <td><font size="2">起始日期</font></td>
          <td><font size="2"><html:text styleClass="inputcss2" property="dtStart" size="18" maxlength="20" onmouseover="OverText(this);"/></font></td>
          <td><font size="2">截止日期</font></td>
          <td><font size="2"><html:text styleClass="inputcss2" property="dtEnd" size="18" maxlength="20" onmouseover="OverText(this);"/></font></td>
        </tr>
        <tr>
          <td><font size="2">部门</font></td>
          <td><font size="2">
    <html:select property="department" style="WIDTH :108px">
      <html:option value="">&nbsp;</html:option>
      <html:options name="userinfo" property="userDept"/>
    </html:select>
          </font></td>
          <td><font size="2"><html:checkbox property="includeUnfinished" value="true"/>包括未完成需求</font></td>
          <td><font size="2"><html:checkbox property="includeFinished" value="true"/>包括已完成需求</font></td>
        </tr>
        <tr>
          <td colspan="4"><font size="2"><div align="center">
    <html:link href="#" onclick="submit(); return false;">Submit</html:link>&nbsp;
    <html:link href="#" onclick="reset(); return false;">Reset</html:link>&nbsp;
    <html:link href="/content/main.jsp">Quit</html:link>
          </div></font></td>
        </tr>
      </table>
    </html:form>
    <hr>查询结果<br>
    <table width="500" border="1" cellpadding="0" cellspacing="0">
            <tr>
              <td width="80"><font size="2">需求编号</font></td>
              <td width="70"><font size="2">提交部门</font></td>
              <td width="200"><font size="2">需求摘要</font></td>
              <td width="80"><font size="2">提交人ID</font></td>
              <td width="70"><font size="2">提交人姓名</font></td>
             </tr>
    <logic:iterate id="list" name="reqSet" property="reqList" type="com.lenovo.shc.req.businesslogic.RequestInfo">
          <tr>
            <td><font size="2"><html:link href="searchDetailAction.do" paramId="reqno" paramName="list" paramProperty="reqNo" target="_blank"><bean:write name="list" property="reqNo"/></html:link></font></td>
            <td><font size="2"><bean:write name="list" property="department"/></font></td>
            <td><font size="2"><bean:write name="list" property="summary"/></font></td>
            <td><font size="2"><bean:write name="list" property="proposerID"/></font></td>
            <td><font size="2"><bean:write name="list" property="proposerName"/></font></td>
          </tr>
    </logic:iterate>
    </table><hr><br>
    </body>
    </html>
    //BEAN
    package com.lenovo.shc.req.businesslogic;public class RequestInfo {
        private String reqNo;
        private String department;
        private String summary;
        private String proposerID;
        private String proposerName;    public String getReqNo(){
          return reqNo;
        }
        public void setReqNo(String reqNo){
          if(reqNo != null){
            this.reqNo = reqNo.trim();
          }
        }    public String getDepartment(){
          return  this.department;
        }
        public void setDepartment(String department){
          if(department != null){
            this.department = department.trim();
          }
        }    public String getSummary(){
          return this.summary;
        }
        public void setSummary(String summary){
          if(summary != null){
            this.summary  = summary.trim();
          }
        }    public String getProposerID(){
          return this.proposerID;
        }
        public void setProposerID(String proposerID){
          if(proposerID != null){
            this.proposerID = proposerID.trim();
          }
        }    public String getProposerName(){
          return this.proposerName;
        }
        public void setProposerName(String proposerName){
          if(proposerName != null){
            this.proposerName = proposerName.trim();
          }
        }
        public RequestInfo() {
          this.reqNo = "";
          this.department = "";
          this.summary = "";
          this.proposerID = "";
          this.proposerName = "";
        }
    }//查询中返回结果集的注意点
            while(rs.next()){
              info = new RequestInfo();
              info.setReqNo(rs.getString("reqno"));
              info.setDepartment(rs.getString("dept"));
              info.setSummary(rs.getString("summary"));
              info.setProposerID(rs.getString("proposerID"));
              info.setProposerName(rs.getString("proposerName"));
              reqList.add(info);
            }
      

  2.   

    先写一个javabean用于查询,然后在actionform中,把查询的结果
                  你的javabean jb = new 你的javabean();
                  ArrayList array = jb.query(); 
                  request.setAttribute("随便一个命名",array) ;
    jsp界面上的处理
      <logic:present name="随便一个命名" scope="request">
         <logic:iterate name="随便一个命名" id="随便一个命名"type="你的Info">
          (你要循环的字段)<td class="table2"><bean:write name="随便一个命名" property="字段名称"/></td>
         </logic:iterate>
     </logic:present>记住:你的显示的字段,必须在查询的结果集中要有,而且在info中必须要定义到
    如果还有什么样的问题[email protected]