SSM项目可以正常启动并访问,控制台无报错,但是项目调用controller层返回404


	
   
	
		CharacterEncodingFilter
		org.springframework.web.filter.CharacterEncodingFilter
		
			encoding
			utf-8
		
		  
            forceEncoding  
            true  
          
	
	
		CharacterEncodingFilter
		/*
		
	
  
  	springmvc
  	org.springframework.web.servlet.DispatcherServlet
  	
  	
  		contextConfigLocation
  		classpath:spring/spring-*.xml
  	
  
  
  
  	springmvc
  	*.do
  
  
    
		contextConfigLocation
		classpath:spring/spring-security.xml
	 
	 
		
			org.springframework.web.context.ContextLoaderListener
		
	 
	
	   
		springSecurityFilterChain  
		org.springframework.web.filter.DelegatingFilterProxy  
	   
	   
		springSecurityFilterChain  
		/*  
	 
	

上述文件为web.xml

此为项目配置文件

SSM项目可以正常启动并访问,控制台无报错,但是项目调用controller层返回404_第1张图片

 

 

 

 

出错原因:

仔细核查后发现是servlet标签下springmvc的解析地址写错了

将classpath:spring/springmvc,xml写成了classpath:spring/spring-*,xml

导致项目无法解析视图。

修改的地方:

修改 classpath:spring/spring-*,xml改为classpath:spring/springmvc,xml

再将context-param标签下的param-value中的值

classpath:spring/spring-security.xml改为classpath:spring/spring-*,xml


	
   
	
		CharacterEncodingFilter
		org.springframework.web.filter.CharacterEncodingFilter
		
			encoding
			utf-8
		
		  
            forceEncoding  
            true  
          
	
	
		CharacterEncodingFilter
		/*
		
	
  
  	springmvc
  	org.springframework.web.servlet.DispatcherServlet
  	
  	
  		contextConfigLocation
  		classpath:spring/springmvc.xml
  	
  
  
  
  	springmvc
  	*.do
  
  
    
		contextConfigLocation
		classpath:spring/spring-*.xml
	 
	 
		
			org.springframework.web.context.ContextLoaderListener
		
	 
	
	   
		springSecurityFilterChain  
		org.springframework.web.filter.DelegatingFilterProxy  
	   
	   
		springSecurityFilterChain  
		/*  
	 
	

更改后,项目就正常了

你可能感兴趣的:(JAVA,BUG)