不要在jsp页面

时间:2016-02-24 13:53:04

标签: java spring jsp

我是java begginer开发人员,我在jsp页面中显示图像有问题。我使用java spring mvc并从aws bucket获取图像这是我在jsp页面中的代码:

<img   alt="fgfg"   src="${Url}"  width="200" height="200"/>

这是我在controler中的代码:

@RequestMapping(value = "/editContact", method = RequestMethod.GET)
public ModelAndView editContact(HttpServletRequest request,ModelMap map) {

int contactId = Integer.parseInt(request.getParameter("contacting_id"));
Contacting Contacting = contactDAO.get(contactId);
User User=contactDAO.getUserByUserID(Integer.parseInt(Contacting.getUser_id()));
User.setFull_name(User.getFirst_name(), User.getLast_name());
Contacting.setUser(User);

//for (int i = 1; i < 4; i++) {
    String bytes=contactDAO.getImages(137+"/before/"+1);

    String Url = "data:image/png;base64," + Base64.encodeBase64String(bytes.getBytes());
    //imageUrls.add(url);
//}

ModelAndView model = new ModelAndView("ContactForm");
model.addObject("Contacting", Contacting);
model.addObject("Url", Url);
return model;}

我调试它并得到这个来源:                                                                                                                         SRC = “数据:图像/ PNG; BASE64,aVZCT1J3MEtHZ29BQUFBTlNVaEVVZ ...”

无论如何我无法在页面中看到该图像,也不会出错 有人可以帮助我吗?

0 个答案:

没有答案