Im working with spring 3.2.3, servlet 3 and maven 3.1, so i'm trying to use i18n, but for some dark reason i can't start my app saying:
javax.servlet.ServletException: javax.servlet.jsp.JspTagException: No message found under code 'login.button.signin' for locale 'pt_BR'.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:912)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)
but my default lang is "EN" and i have both properties with this message.
Code:
WebConfig.java
#Configuration
#EnableWebMvc
#ComponentScan(basePackages = { "com.codesenior.oaon.controller" })
public class WebConfig extends WebMvcConfigurerAdapter {
#Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
}
#Override
public void addInterceptors(InterceptorRegistry registry) {
LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
localeChangeInterceptor.setParamName("lang");
registry.addInterceptor(localeChangeInterceptor);
}
#Bean
public LocaleResolver localeResolver() {
CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
cookieLocaleResolver.setDefaultLocale(StringUtils.parseLocaleString("en"));
return cookieLocaleResolver;
}
#Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
source.setBasename("classpath:messages");
source.setDefaultEncoding("UTF-8");
return source;
}
#Bean
public InternalResourceViewResolver templateResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/pages/");
resolver.setSuffix(".jsp");
resolver.setCache(false);
return resolver;
}
index.jsp
<body>
<div class="container">
<div class="content">
<div class="row">
<span style="float: right">
en
|
pt
</span>
<div class="login-form">
<h2>Login</h2>
<form action="/login">
<fieldset>
<div class="clearfix">
<input id="username" type="text" placeholder="Username">
</div>
<div class="clearfix">
<input id="password" type="password" placeholder="Password">
</div>
<button class="btn btn-primary" onclick="return signin();" value="<spring:message code="login.button.signin"/>" ></button>
</fieldset>
</form>
</div>
</div>
</div>
</div> <!-- /container -->
</body>
messages (current path:src/main/resources)
messages_en.properties
login.label.username=Username
login.label.password=Password
login.button.signin=Signin
messages_pt.properties
login.label.username=Usuário
login.label.password=Senha
login.button.signin=Entrar
Since my default lang is EN, i don't know why it are asking for PT, although even if i ignore this point, i have messages_pt.properties that contains the correct message.
Full stacktrace:
2014-01-14 15:30:49 ERROR MessageTag:83 - No message found under code 'login.button.signin' for locale 'pt_BR'.
javax.servlet.jsp.JspTagException: No message found under code 'login.button.signin' for locale 'pt_BR'.
at org.springframework.web.servlet.tags.MessageTag.doStartTagInternal(MessageTag.java:185)
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)
at org.apache.jsp.WEB_002dINF.pages.index_jsp._jspx_meth_spring_005fmessage_005f0(index_jsp.java:191)
at org.apache.jsp.WEB_002dINF.pages.index_jsp._jspService(index_jsp.java:155)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
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:722)
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:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
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)
Jan 14, 2014 3:30:49 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/checkpointweb] threw exception [An exception occurred processing JSP page /WEB-INF/pages/index.jsp at line 86
83: <div class="clearfix">
84: <input id="password" type="password" placeholder="Password">
85: </div>
86: <button class="btn btn-primary" onclick="return signin();" value="<spring:message code="login.button.signin"/>" ></button>
87: </fieldset>
88: </form>
89: </div>
Stacktrace:] with root cause
javax.servlet.jsp.JspTagException: No message found under code 'login.button.signin' for locale 'pt_BR'.
at org.springframework.web.servlet.tags.MessageTag.doStartTagInternal(MessageTag.java:185)
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)
at org.apache.jsp.WEB_002dINF.pages.index_jsp._jspx_meth_spring_005fmessage_005f0(index_jsp.java:191)
at org.apache.jsp.WEB_002dINF.pages.index_jsp._jspService(index_jsp.java:155)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
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:722)
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:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
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)
Related
I'm using thymeleaf 3.0.7 nad Spring security and trying to make a webapp. Logging and creating accounts runs well but before logging (viewing page as anonymous) i'm getting errors as below:
2018-07-24 21:09:19.124 [http-bio-8090-exec-7] ERROR org.thymeleaf.TemplateEngine - [THYMELEAF][http-bio-8090-exec-7] Exception processing template "error/general": An error happened during template parsing (template: "ServletContext resource [/WEB-INF/views/error/general.html]")
org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "ServletContext resource [/WEB-INF/views/error/general.html]")
at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:241)
at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parseStandalone(AbstractMarkupTemplateParser.java:100)
at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:666)
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098)
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072)
at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:355)
at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:188)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1325)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1069)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1008)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:870)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:855)
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:489)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:467)
at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:338)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
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:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.attoparser.ParseException: Exception evaluating SpringEL expression: "#authorization.expression('isAuthenticated()')" (template: "fragments/layout" - line 34, col 21)
at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:393)
at org.attoparser.MarkupParser.parse(MarkupParser.java:257)
at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230)
... 34 common frames omitted
Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "#authorization.expression('isAuthenticated()')" (template: "fragments/layout" - line 34, col 21)
at org.thymeleaf.spring5.expression.SPELVariableExpressionEvaluator.evaluate(SPELVariableExpressionEvaluator.java:290)
at org.thymeleaf.standard.expression.VariableExpression.executeVariableExpression(VariableExpression.java:165)
at org.thymeleaf.standard.expression.SimpleExpression.executeSimple(SimpleExpression.java:66)
at org.thymeleaf.standard.expression.Expression.execute(Expression.java:109)
at org.thymeleaf.standard.expression.Expression.execute(Expression.java:138)
at org.thymeleaf.standard.expression.NegationExpression.executeNegation(NegationExpression.java:149)
at org.thymeleaf.standard.expression.ComplexExpression.executeComplex(ComplexExpression.java:86)
at org.thymeleaf.standard.expression.Expression.execute(Expression.java:112)
at org.thymeleaf.standard.expression.Expression.execute(Expression.java:138)
at org.thymeleaf.standard.expression.Expression.execute(Expression.java:125)
at org.thymeleaf.standard.processor.StandardIfTagProcessor.isVisible(StandardIfTagProcessor.java:59)
at org.thymeleaf.standard.processor.AbstractStandardConditionalVisibilityTagProcessor.doProcess(AbstractStandardConditionalVisibilityTagProcessor.java:61)
at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74)
at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95)
at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633)
at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1314)
at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205)
at org.thymeleaf.engine.Model.process(Model.java:282)
at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1587)
at org.thymeleaf.engine.TemplateHandlerAdapterMarkupHandler.handleOpenElementEnd(TemplateHandlerAdapterMarkupHandler.java:304)
at org.thymeleaf.templateparser.markup.InlinedOutputExpressionMarkupHandler$InlineMarkupAdapterPreProcessorHandler.handleOpenElementEnd(InlinedOutputExpressionMarkupHandler.java:278)
at org.thymeleaf.standard.inline.OutputExpressionInlinePreProcessorHandler.handleOpenElementEnd(OutputExpressionInlinePreProcessorHandler.java:186)
at org.thymeleaf.templateparser.markup.InlinedOutputExpressionMarkupHandler.handleOpenElementEnd(InlinedOutputExpressionMarkupHandler.java:124)
at org.attoparser.HtmlElement.handleOpenElementEnd(HtmlElement.java:109)
at org.attoparser.HtmlMarkupHandler.handleOpenElementEnd(HtmlMarkupHandler.java:297)
at org.attoparser.MarkupEventProcessorHandler.handleOpenElementEnd(MarkupEventProcessorHandler.java:402)
at org.attoparser.ParsingElementMarkupUtil.parseOpenElement(ParsingElementMarkupUtil.java:159)
at org.attoparser.MarkupParser.parseBuffer(MarkupParser.java:710)
at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:301)
... 36 common frames omitted
Caused by: java.lang.IllegalArgumentException: Authentication object cannot be null
at org.springframework.security.access.expression.SecurityExpressionRoot.<init>(SecurityExpressionRoot.java:61)
at org.springframework.security.web.access.expression.WebSecurityExpressionRoot.<init>(WebSecurityExpressionRoot.java:36)
at org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler.createSecurityExpressionRoot(DefaultWebSecurityExpressionHandler.java:43)
at org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler.createSecurityExpressionRoot(DefaultWebSecurityExpressionHandler.java:33)
at org.springframework.security.access.expression.AbstractSecurityExpressionHandler.createEvaluationContext(AbstractSecurityExpressionHandler.java:66)
at org.thymeleaf.extras.springsecurity4.auth.AuthUtils.authorizeUsingAccessExpression(AuthUtils.java:194)
at org.thymeleaf.extras.springsecurity4.auth.Authorization.expression(Authorization.java:103)
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.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:120)
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:106)
at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:52)
at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:359)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:89)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:110)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:334)
at org.thymeleaf.spring5.expression.SPELVariableExpressionEvaluator.evaluate(SPELVariableExpressionEvaluator.java:263)
... 64 common frames omitted
Since it mentions /WEB-INF/views/error/general.html here it is:
<!DOCTYPE html>
<html xmlns:th="www.thymeleaf.org">
<head>
<title>Error page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link href="../../../resources/css/bootstrap.min.css" rel="stylesheet" media="screen" th:href="#{/resources/css/bootstrap.min.css}"/>
<link href="../../../resources/css/core.css" rel="stylesheet" media="screen" th:href="#{/resources/css/core.css}"/>
</head>
<body>
<div class="container">
<div th:replace="fragments/layout :: header"></div>
<div th:replace="fragments/components :: alert (type='danger', message=${errorMessage})">Error: Error</div>
<div th:replace="fragments/layout :: footer"></div>
</div>
</body>
</html>
And layout.html:
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
<head>
<link href="../../../resources/css/bootstrap.min.css" rel="stylesheet" media="screen" th:href="#{/resources/css/bootstrap.min.css}"/>
</head>
<body>
<!-- Header -->
<div class="navbar navbar-inverse navbar-fixed-top" th:fragment="header">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#" th:href="#{/}">Demo project</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li th:classappend="${module == 'about' ? 'active' : ''}">
About
</li>
<li th:classappend="${module == 'calendar' ? 'active' : ''}">
Calendar
</li>
<li th:classappend="${module == 'event' ? 'active' : ''}"
sec:authorize="hasRole('ROLE_ADMIN')"
>
Formularz
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li th:if="not ${#authorization.expression('isAuthenticated()')}">
<a href="/signin" th:href="#{/signin}">
<span class="glyphicon glyphicon-log-in" aria-hidden="true"></span> Sign in
</a>
</li>
<li th:if="${#authorization.expression('isAuthenticated()')}">
<a href="/logout" th:href="#{#}" onclick="$('#form').submit();">
<span class="glyphicon glyphicon-log-out" aria-hidden="true"></span> Logout
</a>
<form style="visibility: hidden" id="form" method="post" action="#" th:action="#{/logout}"></form>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<!-- Footer -->
<div th:fragment="footer" th:align="center">
© <span th:text="${#temporals.format(#temporals.createNow(), 'yyyy')}">2017</span>
Demo project <span th:text="${#environment.getProperty('app.version')}"></span>
</div>
</body>
</html>
It says that line
<li th:if="not ${#authorization.expression('isAuthenticated()')}">
is the problem and in fact when i change it to return false no errors are thrown. When i change it to use !isAuthenticated() or isAnonymous() instead of "not [...] isAuthenticated()" it throws errors. I have thymeleaf-extras-springsecurity4 dependency added in my pom.xml file as well.
My bet is that i have to work on the fact the authenticated object is null. But what else it could be when i'm checking the website as anonymous?
In general you should always have an authentication object on every page of secured application. Filter org.springframework.security.web.authentication.AnonymousAuthenticationFilter is responsible for setting AnonymousAuthenticationToken in the current security context when it (token) is missing. If this filter is not called it may indicate some problems in security configuration.
BTW try to use xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4" namespace in your Thymeleaf templates. It will shorten security checks a little bit: <div sec:authorize="isAuthenticated()">.
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() {....}
I am using Spring Boot with web mvc tiles. Also using Bootsrap CSS for front end
I have a main layout page named basic.jsp as
<%# taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<html>
<head>
<title><tiles:getAsString name="title" /></title>
</head>
<body>
<!-- Header -->
<tiles:insertAttribute name="header" />
<!-- Body -->
<tiles:insertAttribute name="body" />
<!-- Footer -->
<tiles:insertAttribute name="footer" />
</body>
</html>
and the tiles.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
"http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<tiles-definitions>
<!-- Templates -->
<definition name="layout.basic" template="/pages/layout/basic.jsp">
<put-attribute name="header" value="/pages/jsps/header.jsp" />
<put-attribute name="leftmenu" value="/pages/jsps/lmenu.jsp" />
<put-attribute name="body" value="" />
<put-attribute name="footer" value="/pages/jsps/footer.jsp" />
</definition>
<!-- Pages -->
<definition name="home" extends="layout.basic">
<put-attribute name="body" value="/WEB-INF/tiles/view/home/home.jsp" />
</definition>
<definition name="greet" extends="layout.basic">
<put-attribute name="body" value="/WEB-INF/tiles/view/home/register.jsp" />
</definition>
</tiles-definitions>
I want to include the spring form taglib in my register.jsp
<%# taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<div>
<div class="col-md-9 personal-info">
<form:form method="POST" id="frm" class="form-horizontal" role="form" commandName="box" action="Register">
<div class="form-group">
<label class="col-lg-3 control-label">Box Id:</label>
<div class="col-lg-8">
<form:input class="form-control" path="strBoxId" type="text" placeholder="Box Id"></form:input>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Box Name:</label>
<div class="col-lg-8">
<form:input class="form-control" type="text" path="strBoxName" value="" placeholder="Box Name"></form:input>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Address:</label>
<div class="col-lg-8">
<form:textarea class="form-control" placeholder="Address" path="strAddress"></form:textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"></label>
<div class="col-md-8">
<input type="submit" class="btn btn-primary" id="register" value="Register" onclick="callMe()">
<span></span>
<input type="reset" class="btn btn-default" value="Cancel">
</div>
</div>
</form:form>
</div>
</div>
When I am running the application without including the taglib it is displaying the form, but when I am including the taglib in register.jsp, It is throwing error in cosole as well as Whitelabel Error Page in browser. Th error displayed is
2015-03-05 15:23:45.296 ERROR 8056 --- [nio-8080-exec-8] o.a.c.c.C.[. [localhost].[/].[jsp] : Servlet.service() for servlet jsp threw exception
java.util.NoSuchElementException: null
at java.util.ArrayList$Itr.next(Unknown Source)
at org.apache.jasper.compiler.Validator$ValidateVisitor.getJspAttribute(Validator.java:1385)
at org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1262)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:876)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1538)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2429)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:895)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1538)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2429)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2435)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:474)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377)
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1841)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:217)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
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:770)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:604)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:543)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:688)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:682)
at org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:123)
at org.apache.tiles.request.AbstractViewRequest.dispatch(AbstractViewRequest.java:47)
at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
at org.apache.tiles.request.render.ChainedDelegateRenderer.render(ChainedDelegateRenderer.java:68)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
at org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:188)
at org.apache.tiles.template.InsertAttributeModel.execute(InsertAttributeModel.java:132)
at org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:299)
at org.apache.jsp.pages.layout.basic_jsp._jspx_meth_tiles_005finsertAttribute_005f2(basic_jsp.java:198)
at org.apache.jsp.pages.layout.basic_jsp._jspService(basic_jsp.java:112)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
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:770)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
at org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:265)
at org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:228)
at org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)
at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)
at org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)
at org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:114)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1221)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:8 37)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1720)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1679)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
I don't know where it went wrong. Kindly help :(
Oh God!!! I wasted 3 hours in finding the solution. Thanks to the reply from 'guido' Spring boot taglibs
I just changed my spring boot version to 1.2.2.RELEASE and it worked !!!
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?
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.