首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> Java 程式設計 >> Java 相關知識

Struts 文件上傳實戰(四):planManage.jsp 上傳表單頁面

     編輯:Java 相關知識

planManage.jsp 完整代碼

<%@ 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" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<% request.setCharacterEncoding("gb2312"); %>
<html:html locale="true">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <link href="../css/main.css" rel="stylesheet" type="text/css">
  <title>Add TrainPlan</title>
</head>
<body>
  <table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="tabletoolbar">
    <tr><td class="tabletitletext"><div align="center" class="tabletitletext">Add TrainPlan</div></td></tr>
  </table>
  <html:form action="/maintainAction.do" method="post" enctype="multipart/form-data">
    <table width="600" border="0" align="center" cellpadding="7" cellspacing="0" class="InputFrameMain">
      <tr>
        <td width="3%">&nbsp;</td>
        <td width="11%"><strong>Title</strong></td>
        <td width="22%"><html:text maxlength="50" property="trainPlan.p_title" size="50"/></td>
        <td width="11%"><div align="center"><strong>Issue Time</strong></div></td>
        <td width="22%"><html:text property="trainPlan.issue_time" size="10"/>
          <html:button value="Date" property="Submit"/></td>
        <td width="10%"></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><strong>Post Index</strong></td>
        <td></td>
        <td><div align="center"><strong>Issuer</strong></div></td>
        <td><html:text maxlength="10" property="trainPlan.issuer" size="10"/></td>
      </tr>
    </table>
    <br>
    <table width="595" border="0" align="center" cellpadding="7" cellspacing="0" class="InputFrameMain">
      <tr>
        <td width="10%"><strong>TrainPlan Content</strong>:<br></td>
        <td width="90%"><html:textarea cols="80" rows="5" property="trainPlan.p_content"></html:textarea></td>
      </tr>
    </table>
    <br>
    <table width="610" border="0" align="center" cellpadding="7" cellspacing="0" class="InputFrameMain">
      <tr>
        <td width="595"><span class="InputAreaCell"><strong>Accessory1
          <html:file maxlength="60" property="theFile1" size="60"/><br>
          Accessory2
          <html:file maxlength="60" property="theFile2" size="60"/><br>
          Accessory3
          <html:file maxlength="60" property="theFile3" size="60"/><br>
        </strong></span></td>
      </tr>
      <tr>
        <td><div align="center">
          <html:submit styleClass="button" value="提交" property="Submit" onclick="return RgTest()"/>
        </div></td>
      </tr>
    </table>
  </html:form>
</body>
</html:html>

關鍵標籤說明

  • <html:form enctype="multipart/form-data">:檔案上傳必須指定。
  • <html:text property="trainPlan.p_title">:巢狀屬性綁定,對應 MaintainForm.getTrainPlan().getP_title()。
  • <html:file property="theFile1">:對應 FormFile 屬性,支援多附件。
  • onclick="return RgTest()":提交前客戶端驗證(需自行實現 JS 函數)。
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved