You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
package web.servlet.file ;
import javax.servlet.ServletException ;
import javax.servlet.annotation.WebServlet ;
import javax.servlet.http.HttpServlet ;
import javax.servlet.http.HttpServletRequest ;
import javax.servlet.http.HttpServletResponse ;
import java.io.IOException ;
/**
* 文件处理的Servlet, 用于转发到文件上传页面
*/
@WebServlet ( "/fileServlet" )
public class FileServlet extends HttpServlet {
/**
* 处理POST请求, 转发到文件上传页面。
*
* @param request HTTP请求对象, 包含客户端发送的数据。
* @param response HTTP响应对象, 用于生成返回给客户端的响应。
* @throws ServletException 如果处理请求时发生错误。
* @throws IOException 如果输入或输出异常发生。
*/
protected void doPost ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException {
request . getRequestDispatcher ( "/WEB-INF/admin/uploadFile.jsp" ) . forward ( request , response ) ;
}
/**
* 处理GET请求, 直接调用POST请求处理方法。
*
* @param request HTTP请求对象, 包含客户端发送的数据。
* @param response HTTP响应对象, 用于生成返回给客户端的响应。
* @throws ServletException 如果处理请求时发生错误。
* @throws IOException 如果输入或输出异常发生。
*/
protected void doGet ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException {
doPost ( request , response ) ;
}
}