//web.xml(部分代码) <filter> <filter-name>login</filter-name> <filter-class>org.example.shop.filter.LoginFilter</filter-class> </filter> <filter> <filter-name>main</filter-name> <filter-class>org.example.shop.filter.MainFilter</filter-class> </filter> <filter-mapping> <filter-name>login</filter-name> <url-pattern>/jsp/index.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>main</filter-name> <url-pattern>/jsp/main/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <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>SafeCode</servlet-name> <servlet-class>org.example.shop.util.SafeCode</servlet-class> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>SafeCode</servlet-name> <url-pattern>/safecod</url-pattern> </servlet-mapping> //list.jsp(部分代码) <td> <form action="../../deletegood.do" method="post"> <input type="hidden" name="name" value= '${item.name}'/> <input type="hidden" name="type" value= '${item.type}'/> <input type="submit" value="delete" class="deletegood"/> </form> </td> //controller(部分代码) @RequestMapping("/deletegood") public String deleteGoodsBuName(HttpServletRequest request,@RequestParam("name") String name,@RequestParam("type") String type){ System.out.println("1111111111111111"); goodService.deleteGoodsByName(name); goodService.findGoodsByType(request, type); return "redirect:jsp/main/list.jsp?type="+type; }
Its_forever
相关分类