1.问题:使用ajax提交get请求老是返回errorjava
解决方法:返回格式不正确,dataType若是为json,则须要后台返回的是json值。web
2.问题:没法找到bean:ajax
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
解决办法:由以上的错误的代码能够看到,咱们出现此类bug的缘由:找到不到对应的bean,bean注入失败。spring
注入失败的缘由主要有:json
(1)没有添加注解。例如:@Service @Autowared @Controller app
(2)错误的注入方法ide
(3)对于web.xml中监听器的xml配置错误。学习
因此咱们要解决此问题,主要检查注解正确的添加,包引入是否正确,以及检查web.xml监听器的配置。 ui
1 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentListController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.cason.serviceimpl.StudentBeanServiceImpl com.cason.controller.StudentListController.studentBeanImpl; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.cason.serviceimpl.StudentBeanServiceImpl] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
3.问题:this
java.lang.IllegalStateException: Optional int parameter 'id' is not present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.
解决办法:若是参数是非必须的,则会赋值为null,所以参数应该是一个object,它才能接受这个null值。而上面代码参数page 的类型 为 int,它接受不了null值。
解决办法就是将 int 转换成包装类型 integer