<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>Struts2 File Upload</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">
-->
</head>
<body>
<div style="color.red">
<!-- 获取错误信息 -->
<s:fielderror />
</div>
<!-- 为了完成文件上,设置该表单的enctype属性为multipart/form-data -->
<s:form action="upload" method="post" enctype="multipart/form-data">
<s:textfield name="title" label="文件标题"></s:textfield>
<s:file name="upload" label="选择文件"></s:file>
<s:submit value="上传"></s:submit>
</s:form>
</body>
</html>