html
<html>
<head>
<title>uploading files</title>
</head>
<body>
<form action="basic.jsp教程" method="post">
<input type="file" name="filer">
<br>
<input type="submit" value="submit">
</form>
</body>
</html>
jsp文件
<html>
<head>
<title>uploading files</title>
</head>
<body>
<h1>uploading files</h1>
file name:
<%= request.getparameter("filer") %>
</body>
</html>
xml文档
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- edited with xml spy v4.4 u (http://www.3ppt.com) by nick todd (conygre it limited) -->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
</web-app>
<html>
<head>
<title>uploading files</title>
</head>
<body>
<form action="basic.jsp教程" method="post">
<input type="file" name="filer">
<br>
<input type="submit" value="submit">
</form>
</body>
</html>
jsp文件
<html>
<head>
<title>uploading files</title>
</head>
<body>
<h1>uploading files</h1>
file name:
<%= request.getparameter("filer") %>
</body>
</html>
xml文档
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- edited with xml spy v4.4 u (http://www.3ppt.com) by nick todd (conygre it limited) -->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
</web-app>
本文详细解析了如何使用jsp实现文件上传的功能,包括html页面的表单提交、jsp页面接收文件并显示文件名。
610

被折叠的 条评论
为什么被折叠?



