在SpringBoot里面,如果注解的路径都是正确的还是报404错误

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_41487726/article/details/82773150

在SpringBoot里面,如果注解的路径都是正确的还是报404错误,可能是这个错误:

 

Redis代码自动生成注意事项

@Controller 和 @RestController

自动生成的代码,web目录下的Controller注解都是@Controller,针对不同的应用场景,进行相应的修改。

展开阅读全文

SpringMVC报404错误.

07-03

Dispatcher-servlet.xml:rnrnrnrnrn rn rn rn org.springframework.web.servlet.view.JstlViewrn rn rnrn rn /WEB-INF/view/rn rn rn .jsprn rnrn rnrn rnrn rn rn rn LoginActionrn rn rn rnrn rnrn rn rn net.xiaxin.action.LoginInforn rn rn failrn rn rn successrn rn rnrnrnrnrnrnrnweb.xmlrnrnrnrnrnrn CMSrnrnrnrn rnrn index.jsprnrn rnrn rnrn Dispatcherrnrn rn org.springframework.web.servlet.DispatcherServletrn rn rnrnrn rnrn Dispatcherrnrn *.dornrn rnrnrnrnrnrnrnindex.jsprnrn<%@ page language="java" contentType="text/html; charset=UTF-8"rn pageEncoding="UTF-8"%>rnrnrn rn rn Insert title herern rn rn rn username:rn rn rn password:rn rn rn rn rn rnrnrnrnrnLoginActionrnpublic class LoginAction extends SimpleFormController rn private String fail_view;rn private String success_view;rnrn public ModelAndView onSubmit(Object cmd, BindException ex) rn LoginInfo loginInfo = (LoginInfo) cmd;rn if (login(loginInfo) == 0) rn HashMap result_map = new HashMap();rn result_map.put("logininfo", loginInfo);rn List msgList = new LinkedList();rn msgList.add("msg1");rn msgList.add("msg2");rn msgList.add("msg3");rn result_map.put("messages", msgList);rn return new ModelAndView(this.getSuccess_view(), result_map);rn else rn return new ModelAndView(this.getFail_view());rn rnrn rn private int login(LoginInfo loginInfo) rn if ("Erica".equalsIgnoreCase(loginInfo.getUsername())&& "mypass".equals(loginInfo.getPassword())) rn return 0;rn rn return 1;rnrn rn rn public String getFail_view() rn return fail_view;rn rnrn public String getSuccess_view() rn return success_view;rn rnrnrnrnrncommons-logging.jarrnjstl.jarrnlog4j-1.2.15.jarrnspring.jarrnspring-webmvc.jarrnstandard.jarrnrn首页登录后报404错误:rnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in ServletContext resource [/WEB-INF/Dispatcher-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'LoginAction' defined in ServletContext resource [/WEB-INF/Dispatcher-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'fail_view' of bean class [net.xiaxin.action.LoginAction]: Bean property 'fail_view' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 论坛

没有更多推荐了,返回首页