commentTitle = Utility.escapeStrictHTML(commentTitle);
String commentLine = request.getParameter("comment");
commentLine = Utility.escapeStrictHTML(commentLine);
if (!Format.isNullOrEmpty(commentTitle) || !Format.isNullOrEmpty(commentLine)) {
EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
Content content = ContentDAO.loadNatural(site.getSiteId(), Utility.encode(contentNaturalKey));
Comment comment = new Comment();
comment.setCommentTitle(commentTitle);
comment.setComment(commentLine);
comment.setActive(Constants.VALUE_YES);
String custName = customer.getCustEmail();
if (custName.length() > 20) {
custName = custName.substring(0, 19);
}
comment.setRecCreateBy(custName);
comment.setRecCreateDatetime(new Date(System.currentTimeMillis()));
comment.setRecUpdateBy(custName);
comment.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
comment.setCustomer(customer);
comment.setCommentRating(0);
content.getComments().add(comment);
em.persist(comment);
}
ActionForward forward = actionMapping.findForward("commentSuccess") ;
forward = new ActionForward(forward.getPath() +