==和equals
如图,question1由表单传入,从控制台可以看到值是1,但是一直没有进入if语句中。纠结了好久,把双等号换成了equals成功运行。
== 比较的是变量(栈)内存中存放的对象的(堆)内存地址,用来判断两个对象的地址是否相同,即是否是指相同一个对象。比较的是真正意义上的指针操作。
1、比较的是操作符两端的操作数是否是同一个对象。
2、两边的操作数必须是同一类型的(可以是父子类之间)才能编译通过。
3、比较的是地址,如果是具体的阿拉伯数字的比较,值相等则为true,如:
int a=10 与 long b=10L 与 double c=10.0都是相同的(为true),因为他们都指向地址为10的堆。
equals用来比较的是两个对象的内容是否相等
Tomcat报错
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.itheima.core.service.Impl.UserServiceImpl]; nested exception is java.io.FileNotFoundException: class path resource [com/itheima/core/service/Impl/UserServiceImpl.class] cannot be opened because it does not exist
报错com.itheima.core.service.Impl.UserServiceImpl不存在。
Impl包名开头大写了。。。
6.13更新
返回值类型出错
Servlet.service() for servlet [crm] in context with path [/grade_war_exploded] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Mapper method ‘com.itheima.core.dao.CompanyDao.updatescore’ has an unsupported return type: class com.itheima.core.po.Company] with root cause
org.apache.ibatis.binding.BindingException: Mapper method ‘com.itheima.core.dao.CompanyDao.updatescore’ has an unsupported return type: class com.itheima.core.po.Company
service实现方法
public Company updatescore(Integer id,Integer score,String rater_name){
Company company= companyDao.updatescore(id,score,rater_name);
return company;
}
问题原因:返回类型是Company,Mybatis 在 mapper 接口中定义 insert delete 等操作默认返回值是int,所以返回类型不受支持。
Ajax跳转问题
Ajax跳转到后台方法upload.action,upload.action跳转到web-inf中的一个jsp页面,无法跳转。在action方法中输出字符,发现是执行action方法了的。自己手动通过地址栏转向到action方法成功跳转到指定页面,action方法没问题。发现浏览器地址栏没有转向到upload.action方法。
问题原因:ajax只接受最后返回的值,不会响应跳转请求更改浏览器地址栏地址转向的