springMVC报404需考虑的因素
来源:互联网 发布:美国驾照在中国 知乎 编辑:程序博客网 时间:2024/06/09 14:38
1.web.xml文件中配置:
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springmvc-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
这里设置找的xml是classpath下的springmvc-servlet.xml
2.springmvc-servlet.xml文件的配置:
<!-- 激活注解 -->
<context:annotation-config />
<context:component-scan base-package="cn.it.controller" />
<mvc:annotation-driven />
<!-- 配置试图解析器 -->
<bean id="jspViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<!-- 结果视图的前缀 -->
<property name="prefix" value="/WEB-INF/jsp/" />
<!-- 结果视图的后缀 -->
<property name="suffix" value=".jsp" />
</bean>
3.src下的class类采用注解的方式:
@Controller
@RequestMapping("/***")
4.若web.xml文件中<welcome-file-list>标签下配置<welcome-file>index.jsp</welcome-file>,而你的WebRoot文件夹下没有index.jsp,则也会出现404
- springMVC报404需考虑的因素
- 挑选域名需考虑的因素
- 系统集群架构设计需考虑的几个因素
- 系统构架设计应考虑的因素
- 工作前培训的考虑因素
- 系统构架设计应考虑的因素
- 选择磁盘阵列时需要考虑的因素
- 系统构架设计应考虑的因素
- 系统构架设计应考虑的因素
- 系统构架设计应考虑的因素
- 系统构架设计应考虑的因素
- 系统构架设计应考虑的因素
- 系统构架设计应考虑的因素
- 系统构架设计应考虑的因素
- 系统构架设计应考虑的因素
- 系统构架设计应考虑的因素
- 系统构架设计应考虑的因素
- 统构架设计应考虑的因素
- 覆盖equals时请遵守通用约定。
- 2017.09.06工作日记
- express的常用API(一)
- Java服务端处理Http请求
- React Native单选,多选
- springMVC报404需考虑的因素
- 【Java】类加载机制
- 敏捷开发原则
- hadoop
- .Net Core(二)EFCore
- 纯css实现瀑布流效果
- 设计模式之装饰者模式
- React Native单选,多选
- JS之异步异常处理