Java中如何改变List里对象的属性值
展开全部
//实现查询所有项目信息,查出来后把status字段类型转换 0=“已申报”1=“审核中”2=“已审核”
public List<Projectinfo listAll() {
List<Projectinfo list= projectinfoDao.findAll();
Projectinfo p=list.get(1);
p.Status=Integer.parseInt("申报");
//p.setStatus(Integer.parseInt("申报"));
for(Projectinfo l:list){
System.out.println(l.getStatus());}return list;}报错了!log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Hibernate: select projectinf0_.ID as ID0_, projectinf0_.PROJECT_NAME as PROJECT2_0_, projectinf0_.START_DATE as START3_0_, projectinf0_.END_DATE as END4_0_, projectinf0_.STATUS as STATUS0_ from SCOTT.PROJECTINFO projectinf0_
Exception in thread "main" java.lang.NumberFormatException: For input string: "申报"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Integer.parseInt(Integer.java:497)
at service.ProjectinfoServiceImpl.listAll(ProjectinfoServiceImpl.java:28)
at test.test2.main(test2.java:40)回答:
Map map = new HashMap();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询