当我想在我的 jsp 页面中显示列表时,我收到了这个错误
我的 foreach 循环显示列表:
<c:forEach var="list" items="${consultantsList}" varStatus="iter">
<c:out value="${list.name}"></c:out>
</c:forEach>
我的控制器:
@Controller
@RequestMapping("/patient")
public class PatientController {
@Autowired
private PatientService patientService;
@RequestMapping(value="/registerPatient.htm")
public ModelAndView getRegisterPage()
{
ModelAndView modelAndView=new ModelAndView();
modelAndView.setViewName("register");
List<Consultant> list=patientService.getAllConsultant();
modelAndView.addObject("consultantsList",list);
modelAndView.addObject("patient", new Patient());
return modelAndView;
}
当我完全删除 foreach 循环时,jsp 将毫无例外地显示。
例外:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.tiles.impl.CannotRenderException: ServletException including path '/WEB-INF/jsp/i1-smhBaseLayout.jsp'.
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.ja va:656)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
根本原因:
org.apache.tiles.impl.CannotRenderException: ServletException including path '/WEB-INF/jsp/i1-smhBaseLayout.jsp'.
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:692)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:644)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:627)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:321)
org.springframework.web.servlet.view.tiles2.TilesView.renderMergedOutputModel(TilesView.java:124)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)