大神帮帮忙
心大自然宽 2020-10-12 02:46:45 为什么equals对比总是返回false
@RequestMapping(value = "/yanzheng1.do", method = RequestMethod.GET)
public void yanzheng1(@Param("zdmjText") String zdmjText,@Param("zdmName2")String zdmName2,@Param("targetName") String targetName, HttpServletResponse response) throws IOException {
int count=0;
List<DashboardTargetmanagement> lists = this.planningsDashboardDao.selectTargetmanagementNameAndBase();
// DashboardTargetmanagement s = this.planningsDashboardDao.selectTargetmanagement(targetName);
System.out.println(zdmjText.replace("",","));
String ss = zdmjText.replace(" ",",");
for (DashboardTargetmanagement i : lists ){
if (i.getTargetName().equals(ss) == true){
count=0;
}else {
count++;
}
}
// for (int i= 0 ; i<lists.size();i++) {
// if(lists.equals("zdmjText") == true){
// count=0;
// }else{
// count++;
// };
//
// }
response.setHeader("Content-type", "text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
PrintWriter write = response.getWriter();
write.write(JSONUtils.toJSon(count));
};