java - Why does the same code work in a servlet but not in a Spring controller? -
this code works in servlet:
picasawebservice service = new picasawebservice("picasa test"); picasawebclient picasaclient = new picasawebclient(service); list<albumentry> albums = picasaclient.getalbums("cgcmh1@gmail.com"); for(albumentry album: albums){ resp.getwriter().println(album.gettitle().getplaintext()); list<photoentry> photos = picasaclient.getphotos(album); req.setattribute("photos", photos); }
so tried putting in spring controller using model.addattribute
(below) instead of req.setattribute
(above):
picasawebservice service = new picasawebservice("picasa test"); picasawebclient picasaclient = new picasawebclient(service); list<albumentry> albums = picasaclient.getalbums("cgcmh1@gmail.com"); (albumentry album : albums){ logger.warn("albums:" + album.gettitle().getplaintext()); list<photoentry> photos = picasaclient.getphotos(album); model.addattribute("photos", photos); }
however, spring code fails find albums in picasa while servlet code finds them successfully.
anyone know why case?
in both cases using this version of picasawebclient , this version of picasawebservice.
model.addattribute("photos", photos);
will override photos
attribute of map on each iteration, able access last album.
Comments
Post a Comment