org.attoparser.ParseException: Exception evaluating SpringEL expression: "rvo.user.username" (templa
2020-07-18 04:54
1156 查看
点他可以正常访问
而点他就会报错
由于代码没倒腾明白 导致username没取到
检查了以后发现 在Controller里面 取user的时候 应该取comment表里面的userId,我粗心取了comment的id 所以导致user表里面userId可能没有和comment表中的id一样的值 所以有些页面就会报错 有一些就不会
//帖子 DiscussPost post = discussPostService.findDiscussPostById(discussPostId); model.addAttribute("post",post); //作者 User user = userService.findUserById(post.getUserId()); model.addAttribute("user",user); //评论分页信息 page.setLimit(5); page.setPath("/discuss/detail/"+discussPostId); page.setRows(post.getCommentCount()); // 评论:给帖子的评论 // 回复:给评论的评论 // 评论列表 List<Comment> commentList = commentService.findCommentsByEntity( ENTITY_TYPE_POST, post.getId(), page.getOffset(), page.getLimit()); // 评论VO列表(显示对象的列表) List<Map<String, Object>> commentVoList = new ArrayList<>(); if (commentList != null) { for (Comment comment : commentList) { // 评论VO Map<String, Object> commentVo = new HashMap<>(); // 评论 commentVo.put("comment", comment); // 作者 commentVo.put("user", userService.findUserById(comment.getUserId())); // 回复列表 List<Comment> replyList = commentService.findCommentsByEntity( ENTITY_TYPE_COMMENT, comment.getId(), 0, Integer.MAX_VALUE); // 回复VO列表 List<Map<String, Object>> replyVoList = new ArrayList<>(); if (replyList != null) { for (Comment reply : replyList) { Map<String, Object> replyVo = new HashMap<>(); // 回复 replyVo.put("reply", reply); // 作者 replyVo.put("user", userService.findUserById(reply.getUserId())); // 回复目标 User target = reply.getTargetId() == 0 ? null : userService.findUserById(reply.getTargetId()); replyVo.put("target", target); replyVoList.add(replyVo); } } commentVo.put("replys", replyVoList); //回复数量 int replyCount = commentService.findCommentCount(ENTITY_TYPE_COMMENT, comment.getId()); commentVo.put("replyCount", replyCount); commentVoList.add(commentVo); } } model.addAttribute("comments",commentVoList);
将他改为
一切都好了
相关文章推荐
- TemplateInputException: An error happened during template parsing & org.attoparser.ParseException
- org.apache.lucene.queryParser.ParseException: Encountered "<EOF>" at line 1, column 0.
- org.apache.lucene.queryParser.ParseException: Encountered "<EOF>" at line 1, column 0.
- 解析xml时,报错:WARN/System.err(207): org.apache.harmony.xml.ExpatParser$ParseException: At line 1,
- 解析xml时,报错:org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 75:not well-formed
- org.apache.lucene.queryparser.classic.ParseException: Encountered "<EOF>" at line 1, column 0.
- 解析XML时,org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 449: not well-forme
- org.apache.lucene.queryParser.ParseException: Encountered "<EOF>" at line 1, column 0.
- org.apache.el.parser.ParseException: Encountered " ":" ": "" at line 1, column 1
- org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression
- org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: unknown encoding
- org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: unknown encoding
- org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: unknown encoding
- 解析xml时,报错:org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 4:not well-formed(invaild toke)
- java.util.InvalidPropertiesFormatException: org.xml.sax.SAXParseException: Invalid encoding name "GB
- javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.xerces.jaxp.Documen
- org.apache.el.parser.ParseException--异常
- org.hibernate.hql.internal.ast.QuerySyntaxException: Admin is not mapped [from Admin where username=
- ERROR: org.xml.sax.SAXParseException: The reference to entity must
- 严重: Exception starting Context with name [/web5] org.apache.catalina.LifecycleException: Failed to s