Struts快速学习指南20(内部培训教材)-大部分素材来自于《Programming Jakarta Struts》一书

类别:Java 点击:0 评论:0 推荐:

 

projectlist.jsp内容如下:

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<%@ page contentType="text/html; charset=GB2312" %>

 

<html:html>

<head>

<!—projectlist.title为资源引用-->

<title><bean:message key="projectlist.title"/></title>

<link href="css/main.css" rel="stylesheet" type="text/css">

<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>

<body bgcolor="#ffffff">

<html:form action="projectsearch">

    <table width="70%"  border="0" align="center" cellpadding="3" cellspacing="1" class="tablebodycolor">

    <tr class="tdbodycolor">

      <td colspan="2" class="tdheadcolor">

              <bean:message key="project.project_search"/>

      </td>

    </tr>

    <tr class="tdbodycolor">

      <td width="15%"><div align="right"><bean:message key="project.projectcode"/></div></td>

      <td width="85%">

          <html:select property="projectCodeSign">

              <html:option value="like">like</html:option>

              <html:option value="not like">not like</html:option>

              <html:option value="=">equal</html:option>

              <html:option value="<>">not equal</html:option>

          </html:select>

       <html:text styleClass="input" maxlength="30" property="projectCode" size="30"/>

      </td>

    </tr>

    <tr class="tdbodycolor">

      <td><div align="right"><bean:message key="project.projectname"/></div></td>

      <td>

          <html:select property="projectNameSign">

              <html:option value="like">like</html:option>

              <html:option value="not like">not like</html:option>

              <html:option value="=">equal</html:option>

              <html:option value="<>">not equal</html:option>

          </html:select>

          <html:text styleClass="input" maxlength="30" property="projectName" size="30"/>

      </td>

    </tr>

    <tr class="tdbodycolor">

 

   <tr class="tdbodycolor">

      <td colspan="2"><div align="center">

          <html:hidden property="page"/>

          <html:hidden property="pageCount"/>

        <html:submit><bean:message key="button_search"/></html:submit>

      </div></td>

    </tr>

    </tr>

  </table>

</html:form>

<table width="70%" border="0" align="center" cellpadding="2" cellspacing="1" class="tablebodycolor">

  <tr class="tdheadcolor">

    <td height="19" colspan="6" class="tdbodycolor">

       <input type="button" name="button_create"

            value="<bean:message key="button_create"/>" onclick="javascript:window.location='projectformload.do?action=create'"/>

    </td>

  </tr>

</table>

<table width="70%" border="0" align="center" cellpadding="2" cellspacing="1" class="tablebodycolor">

  <tr class="tdheadcolor">

    <td height="19" colspan="6" class="tdbodycolor"><bean:message key="project.project_list"/></td>

  </tr>

  <tr class="tdheadcolor">

    <td width="92"><div align="center"><bean:message key="project.projectcode"/></div></td>

    <td width="182"><div align="center"><bean:message key="project.projectname"/></div></td>

    <td width="70"><div align="center"><bean:message key="project.discount"/></div></td>

    <td width="139"><div align="center"><bean:message key="project.site"/></div></td>

    <td width="83"><div align="center"><bean:message key="button_edit" /></div></td>

    <td width="83"><div align="center"><bean:message key="button_delete"/></div></td>

  </tr>

  <logic:iterate id="project" name="PROJECTS">

  <tr class="tdbodycolor">

    <td><div align="center"><bean:write name="project" property="projectCode"/></div></td>

    <td><div align="center"><bean:write name="project" property="projectName"/></div></td>

    <td><div align="center"><bean:write name="project" property="discount"/></div></td>

    <td><div align="center"><bean:define id="site" name="project" property="site">

                           </bean:define>

                           <bean:write name="site" property="siteName"/></div></td>

    <td><div align="center">

        <input type="button" name="button_edit"

            value="<bean:message key="button_edit"/>" onclick="javascript:window.location='projectformload.do?action=modify&projectCode=<bean:write name="project" property="projectCode"/>'"/>

    </div></td>

    <td><div align="center">

       <input type="button" name="button_delete"

            value="<bean:message key="button_delete"/>" onclick="javascript:window.location='projectformload.do?action=delete&projectCode=<bean:write name="project" property="projectCode"/>'"/>

    </div></td>

  </tr>

  </logic:iterate>

</table>

 

<!------分页----->

<script language="javascript">

       function firstPage(){

            document.projectSearchForm.page.value = 1;

            document.projectSearchForm.submit();

       }

        function previousPage(){

            document.projectSearchForm.page.value = parseInt(document.projectSearchForm.page.value)-1;

            document.projectSearchForm.submit();

        }

        function nextPage(){

            document.projectSearchForm.page.value = parseInt(document.projectSearchForm.page.value)+1;

            document.projectSearchForm.submit();

        }

        function lastPage(){

            document.projectSearchForm.page.value = document.projectSearchForm.pageCount.value;

            document.projectSearchForm.submit();

        }

</script>

<table width=600 cellspacing="0" cellpadding="0" align="center">

        <tr>

          <td colspan=2><br>

              <div align="center">

              <bean:define id="currPageOb" property="page" name="projectSearchForm"/>

                <bean:define id="pageCountOb" property="pageCount" name="projectSearchForm"/>

                <%int currPage = ((Integer)(currPageOb)).intValue();

                int pageCount = ((Integer)(pageCountOb)).intValue();%>

                <%if(currPage>1){%>

                           <a href="javascript:firstPage();">首页</a>

                        <a href="javascript:previousPage();">上一页</a>

                <%}%>

                <%if(pageCount>currPage){%>

                        <a href="javascript:nextPage();">下一页</a>

                         <a href="javascript:lastPage();">末页</a>

                <%}%>

                当前页:<%=currPage%>,

                共<%=pageCount%>页

              </div>

             </td>

        </tr>

</table>

<!------分页----->

 

</body>

</html:html>

界面显示如下:

本文地址:http://com.8s8s.com/it/it16517.htm