upload.jsp
2018-11-24 本文已影响0人
金厚琦
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
//定义一个上下文名字
String path=request.getContextPath();
//设置一个绝对路径
String basePath=request.getScheme()+"://"
+request.getServerName()+":"+request.getServerPort()
+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- 这是个啥 -->
<base href="<%=basePath%>">
<title>Insert title here</title>
</head>
<body>
<p>${msg}</p>
<form action="uploadservlet" method="post" enctype="multipart/form-data">
name:<input type="text" name="name"/><br>
email:<input type="text" name="email"/><br>
上传文件:<input type="file" name="f1"> <br>
<input type="submit" value="提交">
</form>
</body>
</html>