NutzCN Logo
问答 在操作用户头像上传及显示时,报demo.hello.bean.User cannot be cast to java.lang.Integer,想请教大神是什么原因,感谢!
发布于 1251天前 作者 zhuxiaopizhenhaokan 945 次浏览 复制 上一个帖子 下一个帖子
标签:

@Ok("raw:jpg")
@At("/avatar")
@GET
public Object readAvatar(@Attr(scope=Scope.SESSION, value="me")int userId, HttpServletRequest req) throws SQLException {
UserProfile profile = Daos.ext(dao, FieldFilter.create(UserProfile.class, "^avatar$")).fetch(UserProfile.class, userId);
if (profile == null || profile.getAvatar() == null) {
return new File(req.getServletContext().getRealPath("/image/user_avatar/none.jpg"));
}
return profile.getAvatar();
}

1 回复

me是 user 对象,不是字段吧?

添加回复
请先登陆
回到顶部