浏览器输入http://localhost:8081/dianping/index时,出现HTTP Status 404 – Not Found
来源:2-5 后台内容管理系统搭建
banlureader
2018-07-10
源生活老师,您好!
程序正常启动,http://localhost:8081/dianping会出现 Hello World!页面。
但是输入http://localhost:8081/dianping/index时,出现HTTP Status 404 – Not Found
controller代码如下:
@Controller @RequestMapping("/index") public class IndexController { public String init(){ return "/system/index"; } }
我怀疑是不是我开发环境设置不正确?
写回答
2回答
-
banlureader
提问者
2018-07-10
打扰了,问题已经解决。
@Controller @RequestMapping("/index") public class IndexController { @RequestMapping public String init(){ return "/system/index"; } }
第二个 @RequestMapping 忘记写了 笨啊
00 -
banlureader
提问者
2018-07-10
web.xml文件如下,但是提示有错误。
<?xml version="1.0" encoding="UTF-8"?> <web-app 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" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"> <display-name>大众点评</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <filter> <filter-name>CharacterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>CharacterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/applicationContext.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <include-prelude>/WEB-INF/jsp/system/common.jsp</include-prelude> </jsp-property-group> </jsp-config> </web-app>
00
IT段子手详解MyBatis遇到Spring 秒学Java SSM开发大众点评
【毕设】SSM全面梳理,前后端分离,zTree 和复杂SQL打造权限系统,解惑MyBatis和RESTful
1001 学习 · 485 问题
相似问题