Проблемы
У меня ошибка при отображении записи, я пробую varStatus, но это все еще эта ошибка, Что я должен сделать, чтобы исправить эту ошибку ??В контроллере другого объекта это работает!Tks alot !!!
Репозиторий
public List<RecordFormHomePage> topStaff() {
Session session = this.sessionFactory.getCurrentSession();
List<RecordFormHomePage> recordsList = session.createSQLQuery("select `StaffId`,sum(case when `Type`=1 then 1 else 0 end) as achievement, sum(case when `Type`=0 then 1 else 0 end) as mistake, sum(case when `Type`=1 then 1 else 0 end)-sum(case when `Type`=0 then 1 else 0 end) as total from Records group by `StaffId`\n" +
"").list();
return recordsList;
}
Сервис
@Transactional
public List<RecordFormHomePage> topStaff() {
return recordRepository.topStaff();
}
JSP
<c:forEach var="staff" items="${TopStaff }" varStatus="stt">
<tr>
<td>${staff.stt.total }</td>
</tr>
</c:forEach>
Контроллер
public String index(Model model) {
model.addAttribute("TopStaff", recordService.topStaff());
return "/homepage/index";
}
RecordFormHomePage
public class RecordFormHomePage implements Serializable{
int StaffId;
int Achievement;
int mistake;
int total;
Ошибка
java.lang.NumberFormatException: For input string: "stt"
java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
java.lang.Integer.parseInt(Integer.java:580)
java.lang.Integer.parseInt(Integer.java:615)
javax.el.ArrayELResolver.coerce(ArrayELResolver.java:144)
javax.el.ArrayELResolver.getValue(ArrayELResolver.java:61)
org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:110)
org.apache.el.parser.AstValue.getValue(AstValue.java:169)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:190)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:944)
org.apache.jsp.WEB_002dINF.views.homepage.index_jsp._jspx_meth_c_005fforEach_005f0(index_jsp.java:810)
org.apache.jsp.WEB_002dINF.views.homepage.index_jsp._jspService(index_jsp.java:266)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1257)
org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
ткс столько !!!