文件上传(上传页面)

<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
<title>using commons fileupload to upload file </title>
<base href="<%=basePath%>">
</head>

<body>
<div align="center">
  <p>请选择需要上传的文件</p>
  <form action="servlet/upload" method="post" enctype="multipart/form-data" name="form1" id="form1">
    <table width="334" border="1">
      <tr>
        <td width="150">上传人:</td>
        <td width="168"><label>
          <input type="text" name="name" id="name" />
        </label></td>
      </tr>
      <tr>
        <td>上传文件:</td>
        <td><label>
          <input type="file" name="uploadfile" id="uploadfile" />
        </label></td>
      </tr>
      <tr>
        <td><label>
          <input type="reset" name="button" id="button" value="重置" />
        </label></td>
        <td><label>
          <input type="submit" name="button2" id="button2" value="提交" />
        </label></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
  </form>
  <p>&nbsp;</p>
  <p>&nbsp;  </p>
</div>
</body>
</html>

 

你可能感兴趣的:(html,servlet,XHTML)