get the MovieRecommendation throw exception - spring

i use spring data neo4j to work,i have a repository to recommend movie,i think cypher have not problem,and i can get the recommendation,but i can not get the value of Movie.title and rating ,why it shows movie id not property to the recommendation.class,in my log and error info you can see,why ?
i have severl similar problems,it seems cant get the value in jsp?help me thank you very much .heart man
recommendation.class
package com.oberon.fm.domain;
import org.springframework.data.neo4j.annotation.QueryResult;
#QueryResult
public class MovieRecommendation {
Movie movie;
int rating;
the repository
#Query("match (user:User {login: {0}})-[r:RATED]->(movie)<-[r2:RATED]-(other)-[r3:RATED]->(otherMovie) "
+ " where r.stars >= 3 and r2.stars >= r.stars and r3.stars >= r.stars "
+ " with otherMovie, avg(r3.stars) as rating, count(*) as cnt"
+ " order by rating desc, cnt desc"
+ " return otherMovie limit 10")
List<MovieRecommendation> getRecommendations(String login);
my controller
#RequestMapping(value = "/user", method = RequestMethod.GET)
public String profile(Model model, HttpServletRequest request) {
// User user=populator.getUserFromSession();
HttpSession session = request.getSession(false);
User user = (User) session.getAttribute("user");
model.addAttribute("user", user);
if (user != null) {
List<MovieRecommendation> mr = movieRepository.getRecommendations(user.getLogin());
model.addAttribute("recommendations", mr);
}
return "user/index";
}
index.jsp
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%# taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%# page contentType="text/html;charset=UTF-8" language="java" %>
<%--#elvariable id="user" type="com.oberon.fm.domain.User"--%>
<%--#elvariable id="recommendations"type="java.util.List<com.oberon.fm.domain.MovieRecommendation>"--%>
<%--#elvariable id="recommendation"type="com.oberon.fm.domain.MovieRecommendation"--%>
<html>
<head>
<title>Profile</title>
<link rel="stylesheet" type="text/css" href="/Web/css/style.css"/>
</head>
<body>
<div class="span-third">
<h2>Your recommendations</h2>
</div>
<div class="span-third last">
<h2>${fn:length(recommendations)}</h2>
</div>
<ul class="rated-movies-list span-all last">
<c:choose>
<c:when test="${not empty recommendations}">
<c:forEach items="${recommendations}" var="recommendation">
<c:set var="movie" value="${recommendation.movie}"/>
<c:set var="stars" value="${recommendation.rating}"/>
<li>
<h4> <a href="<c:url value="/movies/${movie.id}" />"><c:out value="${movie.title}"/>
(${movie.year}) - "${movie.tagline}"</a>
<img class="rating" alt="${stars} stars" src="<c:url value="/images/rated_${stars}.png" />"/>
</h4>
</li>
</c:forEach>
</c:when>
<c:otherwise>
There are no recommendations for you, perhaps you have to add some friends?
</c:otherwise>
</c:choose>
</ul>
<div class="break"></div>
</div>
</div>
i can get the length of recommendation
log and error info
16:19:32.403 [http-nio-8080-exec-8] DEBUG o.s.w.b.a.s.HandlerMethodInvoker - Invoking request handler method: publicjava.lang.String com.oberon.fm.controller.UserController.profile(org.springframework.ui.Model, javax.servlet.http.HttpServletRequest)
16:19:32.403 [http-nio-8080-exec-8] DEBUG o.s.t.jta.JtaTransactionManager - Creating new transaction with name [null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
16:19:32.404 [http-nio-8080-exec-8] DEBUG o.s.d.n.s.q.CypherQueryEngineImpl - Executing cypher query: match (user:User {login: {0}})-[r:RATED]->(movie)<-[r2:RATED]-(other)-[r3:RATED]->(otherMovie) where r.stars >= 3 and r2.stars >= r.stars and r3.stars >= r.stars with otherMovie, avg(r3.stars) as rating, count(*) as cnt order by rating desc, cnt desc return otherMovie limit 10 params {0=micha}
16:19:32.739 [http-nio-8080-exec-8] DEBUG o.s.t.jta.JtaTransactionManager - Initiating transaction commit
16:19:32.740 [http-nio-8080-exec-8] DEBUG c.o.fm.controller.UserController - ()()()()()()()()()()()[com.oberon.fm.domain.MovieRecommendation#bc5162, com.oberon.fm.domain.MovieRecommendation#1b8ceab]
16:19:32.740 [http-nio-8080-exec-8] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Invoking afterPropertiesSet() on bean with name 'user/index'
16:19:32.740 [http-nio-8080-exec-8] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
16:19:32.740 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.DispatcherServlet - Rendering view [org.springframework.web.servlet.view.JstlView: name 'user/index'; URL [/pages/user/index.jsp]] in DispatcherServlet with name 'context'
16:19:32.740 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.view.JstlView - Added model object 'user' of type [com.oberon.fm.domain.User] to request in view with name 'user/index'
16:19:32.740 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.view.JstlView - Added model object 'recommendations' of type [java.util.ArrayList] to request in view with name 'user/index'
16:19:32.740 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.view.JstlView - Added model object 'org.springframework.validation.BindingResult.user' of type [org.springframework.validation.BeanPropertyBindingResult] to request in view with name 'user/index'
16:19:32.740 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.view.JstlView - Forwarding to resource [/pages/user/index.jsp] in InternalResourceView 'user/index'
16:19:33.838 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.DispatcherServlet - Error rendering view [org.springframework.web.servlet.view.JstlView: name 'user/index'; URL [/pages/user/index.jsp]] in DispatcherServlet with name 'context'
org.apache.jasper.JasperException: An exception occurred processing JSP page /pages/user/index.jsp at line 86
83: <c:choose>
84: <c:when test="${not empty recommendations}">
85: <c:forEach items="${recommendations}" var="recommendation">
86: <c:set var="movie" value="${recommendation.movie}"/>
87: <c:set var="stars" value="${recommendation.rating}"/>
88: <li>
89: <h4> <a href="<c:url value="/movies/${movie.id}" />"><c:out value="${movie.title}"/>:
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) ~[jasper.jar:8.0.15]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470) ~[jasper.jar:8.0.15]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) ~[jasper.jar:8.0.15]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) ~[jasper.jar:8.0.15]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) [servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) [catalina.jar:8.0.15]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.15]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-websocket.jar:8.0.15]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.15]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.15]
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:721) ~[catalina.jar:8.0.15]
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466) ~[catalina.jar:8.0.15]
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391) ~[catalina.jar:8.0.15]
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318) ~[catalina.jar:8.0.15]
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168) ~[spring-webmvc-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) ~[spring-webmvc-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1228) [spring-webmvc-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1011) [spring-webmvc-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:955) [spring-webmvc-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) [spring-webmvc-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) [spring-webmvc-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) [spring-webmvc-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:618) [servlet-api.jar:na]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) [spring-webmvc-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) [servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) [catalina.jar:8.0.15]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.15]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-websocket.jar:8.0.15]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.15]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.15]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.15]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.15]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) [catalina.jar:8.0.15]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [catalina.jar:8.0.15]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) [catalina.jar:8.0.15]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) [catalina.jar:8.0.15]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:8.0.15]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) [catalina.jar:8.0.15]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.15]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537) [catalina.jar:8.0.15]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085) [tomcat-coyote.jar:8.0.15]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658) [tomcat-coyote.jar:8.0.15]
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) [tomcat-coyote.jar:8.0.15]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1556) [tomcat-coyote.jar:8.0.15]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1513) [tomcat-coyote.jar:8.0.15]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_05]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_05]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.15]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_05]
Caused by: org.apache.jasper.el.JspPropertyNotFoundException: /pages/user/index.jsp(86,26) '${recommendation.movie}' Property 'movie' not found on type com.oberon.fm.domain.MovieRecommendation
at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:120) ~[jasper.jar:8.0.15]
at org.apache.jsp.pages.user.index_jsp._jspx_meth_c_005fset_005f3(index_jsp.java:879) ~[na:na]
at org.apache.jsp.pages.user.index_jsp._jspx_meth_c_005fforEach_005f2(index_jsp.java:818) ~[na:na]
at org.apache.jsp.pages.user.index_jsp._jspx_meth_c_005fwhen_005f2(index_jsp.java:782) ~[na:na]
at org.apache.jsp.pages.user.index_jsp._jspx_meth_c_005fchoose_005f2(index_jsp.java:746) ~[na:na]
at org.apache.jsp.pages.user.index_jsp._jspService(index_jsp.java:171) ~[na:na]
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) ~[jasper.jar:8.0.15]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) [servlet-api.jar:na]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) ~[jasper.jar:8.0.15]
... 49 common frames omitted

You need to have getters for jsp el expressions, it won't recognize public properties.
Change your MovieRecommendation class (and possibly others) to something like this:
#QueryResult
public class MovieRecommendation {
Movie movie;
int rating;
Movie getMovie() { .... }
int getRating() {....}

Related

ModelAttribute fields are null

I am facing this strange behaviour whith Spring MVC and JSP where the ModelAttribute is sent to the JSP with populated fields but when it is returned to the controller all the fields are null.
So first of all I put an object as attribute in the model.
#PostMapping("qcm")
public String qcm(#ModelAttribute("qcm") Qcm formQcm, Model model) {
Qcm q = props.getQcm(formQcm.getDomaine(), formQcm.getMode());
model.addAttribute("qcm", q);
this.qcm = q;
return "qcm";
}
The ModelAttribute here works just fine. But note that I add a new attribute to the model here.
In the qcm.jsp page I display a form with some information from the qcm object I put in the model earlier. That means there is no way I send the fields of qcm as null in the first place.
Here is qcm.jsp:
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%# taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<div class="container">
<h1 class="h3 mb-3 font-weight-normal">QCM</h1>
<form:form action="sendqcm" modelAttribute="qcm" method="POST">
<c:forEach var="question" items="${qcm.questions}">
<p>${question.data}?</p>
<c:forEach var="reponse" items="${question.reponses}">
<div class="form-check form-check-inline">
<form:radiobutton path="${question.chosenReponse}" value="${reponse}" label="${reponse.data}" class="form-check-input"/>
</div>
</c:forEach>
</c:forEach>
<input type="submit" value="envoyer" class="save" class="btn btn-lg btn-primary btn-block"/>
</form:form>
</div>
</body>
</html>
The informations are displayed just fine. I mapped the action to the sendqcm controller. Here it is:
#PostMapping("sendqcm")
public String sendqcm(#ModelAttribute("qcm") Qcm formQcm, Model model) {
System.out.println("Domaine -> " + formQcm.getDomaine());
System.out.println("Mode -> " + formQcm.getMode());
for(Question q : formQcm.getQuestions()) {
System.out.println(q.getChosenReponse());
}
for (Question q : formQcm.getQuestions()) {
if (q.answeredCorrectly())
score++;
}
model.addAttribute("score", score);
return "reponses";
}
The two lines of System.out.println() return null and then the program fails with NullPointerException:
java.lang.NullPointerException
at fr.insa.controller.AppController.sendqcm(AppController.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
You can add the #ControllerAdvice assists a controller and in particular, so #ModelAttribute methods that apply to all #RequestMapping methods.

Getting this error while working on Spring MVC and Apache tiles

I am not sure where the error is.
message
Request processing failed; nested exception is org.apache.tiles.impl.CannotRenderException:
org.apache.tiles.util.TilesIOException:
JSPException including path '/WEB-INF/views/hotels/enterBookingInfo.jsp'.
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.springframework.web.util.NestedServletException:
Request processing failed; nested exception is org.apache.tiles.impl.CannotRenderException:
org.apache.tiles.util.TilesIOException: JSPException including path '/WEB-INF/views/hotels/enterBookingInfo.jsp'.
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
root cause
org.apache.tiles.impl.CannotRenderException: org.apache.tiles.util.TilesIOException:
JSPException including path '/WEB-INF/views/hotels/enterBookingInfo.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.js.ajax.tiles2.AjaxTilesView.renderMergedOutputModel(AjaxTilesView.java:131)
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:624)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
tiles.xml defintion is as follows
<tiles-definitions>
<definition name="enterBookingInfo" extends="standardLayout">
<put-attribute name="body" value="/WEB-INF/views/hotels/enterBookingInfo.jsp"> </put-attribute>
</definition>
</tiles-definitions>
Tiles configuration extract
<beans:bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<beans:property name="definitions">
<beans:value>
/WEB-INF/**/tiles.xml
</beans:value>
</beans:property>
</beans:bean>
I got this resolved by setting the commandName attribute of the form to the name of the modelAttribute object used in my controller.
I also had to modify the method syntax to have BindingResult parameter which had to follow the ModelAttribute object.
public String ultimateBooking(#RequestParam("hotelId") String hotelId,#ModelAttribute("booking") Booking bookingValidation,BindingResult result,ModelMap model)
No changes were made to tile.xml

org.apache.jasper.JasperException: An exception occurred processing JSP page using spring and hibernate

org.apache.jasper.JasperException: An exception occurred processing JSP page /person.jsp at line
</c:if>
<tr> <td> <form:label path="name">
<spring:message text="Name"/>
</form:label></td>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:574)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:471)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Spring tiles jsp table records from other class

I try to configure spring with tiles and create a website - one to mane relation -> Klient - Pobyt and got a question regarding configuration.
I have got a class Klient and a class Pobyt, I also set up a view, but I am getting a null pointer exception when using = ${klient.idKlienta} in order to connect a klient to a list of pobyt`s.
I am getting a org.postgresql.util.PSQLException:- Error in postgresSQL syntax.
Using a concrete value in sql works fine.
Any idea what is wrong?
Could yoy help?
Here is the .jsp:
<%#page language="Java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%#taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%#taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%#taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<html >
<head>
<title>Insert title here</title>
</head>
<body>
<sql:setDataSource var="postgres" driver="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/MAS_PRO" user="postgres"
password="qwe" scope="session" />
<sql:query dataSource="${postgres}" var="result">
SELECT * from Pobyt
where idklienta=${klient.idKlienta} // when entering an existing id fe. 1 it works fine
</sql:query>
<table border="1" width="100%">
<tr>
<th>Id Pobytu</th>
<th>Data od</th>
<th>do</th>
<th>Id klienta</th>
</tr>
<c:forEach var="row" items="${result.rows}">
<tr>
<td><c:out value="${row.idpobytu}"/></td>
<td><c:out value="${row.datazameldowania}"/></td>
<td><c:out value="${row.datawymeldowania}"/></td>
<td><c:out value="${row.idklienta}" /></td>
</tr>
</c:forEach>
</table>
</body>
</html>
PobytBean and KlientBean:
public class PobytBean {
private Integer idPobytu;
private Date dataZameldowania;
private Date dataWymeldowania;
private Integer idKlienta;
public class KlientBean {
private Integer idKlienta;
private String imie;
private String nazwisko;
private String nrTelefonu;
private String eMail;
Klient and Pobyt
#Entity
#Table(name = "Klient")
public class Klient implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue
#Column(name="idKlienta")
private Integer idKlienta;
#Column(name = "imie")
private String imie;
#Column(name = "nazwisko")
private String nazwisko;
#Column(name = "nrTelefonu")
private String nrTelefonu;
#Column(name = "eMail")
private String eMail;
#Entity
#Table(name = "Pobyt")
public class Pobyt implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue
#Column(name = "idPobytu")
private Integer idPobytu;
#Column(name = "dataZameldowania")
#Temporal(TemporalType.DATE)
private Date dataZameldowania;
#Column(name = "dataWymeldowania")
#Temporal(TemporalType.DATE)
private Date dataWymeldowania;
#ManyToOne
#JoinColumn(name="idKlienta", insertable=false, updatable=false)
public Klient klient;
private Integer idKlienta;
Here is the .jsp from where I try to get to the concrete list of pobyts
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Pobyty</title>
</head>
<body>
<h1>Lista klientow</h1>
<c:if test="${!empty klienci}">
<table align="left" border="1">
<tr>
<th>Klient id</th>
<th>Imie</th>
<th>Nazwisko</th>
<th>Nr Telefonu</th>
<th>e-Mail</th>
<th>Akcja</th>
</tr>
<c:forEach items="${klienci}" var="klient">
<tr>
<td><c:out value="${klient.idKlienta}" /></td>
<td><c:out value="${klient.imie}" /></td>
<td><c:out value="${klient.nazwisko}" /></td>
<td><c:out value="${klient.nrTelefonu}" /></td>
<td><c:out value="${klient.eMail}" /></td>
<td>Otwórz</td>
</tr>
</c:forEach>
</table>
</c:if>
</body>
</html>
Update:
SEVERE: Servlet.service() for servlet jsp threw exception
org.postgresql.util.PSQLException: org.postgresql.util.psqlexception error syntax error at end of input
(Position 44)
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2101)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1834)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:510)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:386)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:271)
at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doEndTag(QueryTagSupport.java:224)
at org.apache.jsp.WEB_002dINF.views.openKlient_jsp._jspx_meth_sql_005fquery_005f0(openKlient_jsp.java:202)
at org.apache.jsp.WEB_002dINF.views.openKlient_jsp._jspService(openKlient_jsp.java:91)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:684)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:678)
at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:103)
at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96)
at org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44)
at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
at org.apache.tiles.renderer.impl.ChainedDelegateAttributeRenderer.write(ChainedDelegateAttributeRenderer.java:76)
at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:670)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:336)
at org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:210)
at org.apache.tiles.template.InsertAttributeModel.end(InsertAttributeModel.java:126)
at org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:311)
at org.apache.jsp.WEB_002dINF.views.mainTemplate_jsp._jspx_meth_tiles_005finsertAttribute_005f3(mainTemplate_jsp.java:180)
at org.apache.jsp.WEB_002dINF.views.mainTemplate_jsp._jspService(mainTemplate_jsp.java:94)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
at org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:241)
at org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:222)
at org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44)
at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:670)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:690)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:644)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:627)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:321)
at org.springframework.web.servlet.view.tiles2.TilesView.renderMergedOutputModel(TilesView.java:124)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1060)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
And the "server is complaining" about:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.tiles.impl.CannotRenderException: ServletException including path '/WEB-INF/views/mainTemplate.jsp'.
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:659)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause
org.apache.tiles.impl.CannotRenderException: ServletException including path '/WEB-INF/views/mainTemplate.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:1060)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
I tried to search for logs and what I have found is:
Tomcat log:
0:0:0:0:0:0:0:1 - - [22/Feb/2014:18:34:40 +0100] "GET /MAS_Koncowy/welcome.html HTTP/1.1" 200 1786
0:0:0:0:0:0:0:1 - - [22/Feb/2014:18:34:43 +0100] "GET /MAS_Koncowy/klienci.html HTTP/1.1" 200 2441
0:0:0:0:0:0:0:1 - - [22/Feb/2014:18:34:44 +0100] "GET /MAS_Koncowy/openKlient.html?id=1 HTTP/1.1" 500 17745
In Pg_log I have found what I`ve already posted:
2014-02-22 18:43:36 CET error syntax error at end of input (Position 44)
2014-02-22 18:43:36 CET Query:
SELECT * from Pobyt
where idKlienta =
So the problem is the idKlienta is not passed to the query? How can I solve it?

How to Update a page in Spring mvc

Can someone please point me to the right direction, it is a very simple spring form that I'm trying to edit. I have tried various examples from net but can not get it working.
<form:form id="myForm" modelAttribute="contacts" method="Post" action="contacts.html" commandName="contacts">
<label>First Name<span class="small">Edit your first name</span></label>
<form:input path="firstName" /><br>
<form:errors path="firstName" cssClass="error" /><br>
<label>Last Name<span class="small">Edit your last name</span></label>
<form:input path="lastName" /><br>
<form:errors path="lastName" cssClass="error" /><br>
<button type="submit">Amend</button>
</form:form>
protected static final String EDIT_VIEW_KEY = "editForm";
#Autowired
private ContactsService conService;
#RequestMapping(value="/edit/{id}", method = RequestMethod.GET)
public String showEditForm(#PathVariable("id") Integer id,
#ModelAttribute("contacts") Contacts contacts,Model model){
model.addAttribute("contacts", conService.listContactsById(id));
return EDIT_VIEW_KEY;
}
and the error I'm getting is this;
org.springframework.beans.NotReadablePropertyException: Invalid property 'firstName' of bean class [java.util.ArrayList]: Bean property 'firstName' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:729)
org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:721)
org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:147)
org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:178)
org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:198)
org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:164)
org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:151)
org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:142)
org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:126)
org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:421)
org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142)
org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
org.apache.jsp.WEB_002dINF.views.editForm_jsp._jspx_meth_form_005finput_005f0(editForm_jsp.java:214)
org.apache.jsp.WEB_002dINF.views.editForm_jsp._jspx_meth_c_005fforEach_005f0(editForm_jsp.java:173)
org.apache.jsp.WEB_002dINF.views.editForm_jsp._jspx_meth_form_005fform_005f0(editForm_jsp.java:128)
org.apache.jsp.WEB_002dINF.views.editForm_jsp._jspService(editForm_jsp.java:85)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:684)
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:678)
org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:103)
org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96)
org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44)
org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
org.apache.tiles.renderer.impl.ChainedDelegateAttributeRenderer.write(ChainedDelegateAttributeRenderer.java:76)
org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:670)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:336)
org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:210)
org.apache.tiles.template.InsertAttributeModel.end(InsertAttributeModel.java:126)
org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:311)
org.apache.jsp.WEB_002dINF.jsp.layout_jsp._jspx_meth_tiles_005finsertAttribute_005f3(layout_jsp.java:180)
org.apache.jsp.WEB_002dINF.jsp.layout_jsp._jspService(layout_jsp.java:98)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:241)
org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:222)
org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44)
org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:670)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:690)
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:262)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1157)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:927)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Many thanks
You're passing back a list to your form:
Invalid property 'firstName' of bean class [java.util.ArrayList]
Your form expects things like a firstName field.
In general, a list won't have a firstName field, although they might contain a collection of objects that have a firstName field. Did you mean to iterate over the list with a form per item?
you are using modelAttribute="contacts" in form and I think that contacts is ArrayList so it is not contains firstName, if your list have object of bean contains "firstName" you can use to iterate on it or use modelAttribute="contacts[${i}]" and set i using with the value you want.

Resources