0
嗨我想從servlet打印列表到網頁屏幕(jsp) 我正在使用日誌,它不工作。 無論如何要做或我是否在使用這個錯誤?如何從servlet打印到網頁?
private static final Logger log = Logger.getLogger(TodoServiceServlet.class.getName());
.....
Todo tmp = pm.getObjectById(Todo.class, user.getEmail());
System.out.println("user email: " + user.getEmail());
if(tmp==null){
log.info("You have not stored any todo lists yet");
}else{
System.out.println("user email is there?: " + tmp.getEmail());
System.out.println("start printing");
ArrayList<String> todolists = tmp.getList();
if(todolists==null)
System.out.println("Arraylist null");
if(!todolists.isEmpty()){
for(String t : todolists){
System.out.println("In the list: " + t);
log.info("You need to do: " + t);
}
}else{
log.info("You have nothing to do chil out!");
}
謝謝!有用! – 2011-12-13 21:12:45