程序全部都写完后,发现打开首页正常,点击生成报表,直接出现了404的报错!?
HTTP Status 404 - /TestReport/ShowReport
type Status report
message /TestReport/ShowReport
description The requested resource is not available.
Apache Tomcat/7.0.85
http://localhost:8080/TestReport/ShowReport
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name></display-name>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>ShowReport</servlet-name>
<servlet-class>servlet.ShowReport</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ShowReport</servlet-name>
<url-pattern>/servlet/ShowReport</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
-------------------------------------------------------------------------------------------
<form action="ShowReport" method="post">
<input type="submit" value="生成报表">
</form>
........................
-------------------------------------------------------------------------------------------------
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//----------------控制层--------------------------------------------
Service service=new Service();
List list=service.getProfit();//看起来这里没有new,那是因为在service里面new过了。
request.getSession().setAttribute("PROFIT", list);
response.sendRedirect("index.jsp");