javascript - Thymeleaf 对象到 Javascript 对象错误 : TemplateProcessingException

标签 javascript java spring thymeleaf

对于我的 Spring MVC 项目,我尝试将 Thymeleaf 列表对象从模型传递到 Javascript,但是,我在控制台上收到以下错误:

ERROR: org.thymeleaf.TemplateEngine - [THYMELEAF][tomcat-http--12] Exception processing template "eventList": Error during execution of processor 'org.thymeleaf.standard.processor.text.StandardTextInliningTextProcessor'

这是 JavaScript 代码:

<script th:inline="javascript">
    /*<![CDATA[*/
    var eventList = [[${eventList}]];
    for(var i = 0; i < eventList.length; i++){
        console.log(eventList[i]);
    }
    /*]]>*/
</script>

事件列表是 ListEvent 。这是我的Event对象:

import java.util.List;

import org.joda.time.DateTime;

/**
 * Model to represent an event
 *
 */
// TODO: Add field for list of attachments
public class Event {
    private String eventId;
    private String title;
    private String description;
    private int points;
    private Location location;
    private DateTime startDate;
    private DateTime endDate;
    private List<User> attendees;

    public String getEventId() {
        return eventId;
    }

    public void setEventId(String eventId) {
        this.eventId = eventId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public int getPoints() {
        return points;
    }

    public void setPoints(int points) {
        this.points = points;
    }

    public Location getLocation() {
        return location;
    }

    public void setLocation(Location location) {
        this.location = location;
    }

    public DateTime getStartDate() {
        return startDate;
    }

    public void setStartDate(DateTime startDate) {
        this.startDate = startDate;
    }

    public DateTime getEndDate() {
        return endDate;
    }

    public void setEndDate(DateTime endDate) {
        this.endDate = endDate;
    }

    public List<User> getAttendees() {
        return attendees;
    }

    public void setAttendees(List<User> attendees) {
        this.attendees = attendees;
    }
}

这是我的User对象:

import java.util.Map;

/**
 * Model that represents a user
 *
 */
public class User {
    private String username;
    private String password;
    private String email;
    private Map<Event, Boolean> eventList;
    private Integer points;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Map<Event, Boolean> getEventList() {
        return eventList;
    }

    public void setEventList(Map<Event, Boolean> eventList) {
        this.eventList = eventList;
    }

    public Integer getPoints() {
        return points;
    }

    public void setPoints(Integer points) {
        this.points = points;
    }

}

这是我的Location对象:

/**
 * Model to represent a location
 *
 */
public class Location {
    private String name;
    private String address;
    private String roomNumber;
    private double latitude;
    private double longitude;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getRoomNumber() {
        return roomNumber;
    }

    public void setRoomNumber(String roomNumber) {
        this.roomNumber = roomNumber;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

}

这是我的WebConfig.java文件:

/**
 * Default web configurer
 */
@Configuration
@EnableWebMvc
@ComponentScan({ "edu.ilstu.business.era.configurations", "edu.ilstu.business.era.controllers",
        "edu.ilstu.business.era.repositories", "edu.ilstu.business.era.mappers", "edu.ilstu.business.era.utilities" })
public class WebConfig extends WebMvcConfigurerAdapter {

    /**
     * Folder with views
     */
    private static final String TEMPLATE_RESOLVER_PREFIX = "/WEB-INF/views/prod/";

    /**
     * View extension
     */
    private static final String TEMPLATE_RESOLVER_SUFFIX = ".html";

    /**
     * View type
     */
    private static final String TEMPLATE_RESOLVER_TEMPLATE_MODE = "HTML5";

    /**
     * Configure view resolver bean
     * 
     * @return
     */
    @Bean
    public ViewResolver viewResolver() {
        ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
        viewResolver.setTemplateEngine(templateEngine());

        return viewResolver;
    }

    /**
     * Configure the template engine
     * 
     * @return
     */
    @Bean
    public SpringTemplateEngine templateEngine() {
        SpringTemplateEngine templateEngine = new SpringTemplateEngine();
        templateEngine.setTemplateResolver(templateResolver());

        return templateEngine;
    }

    /**
     * Configure the template resolver
     * 
     * @return
     */
    @Bean
    public TemplateResolver templateResolver() {
        TemplateResolver templateResolver = new ServletContextTemplateResolver();
        templateResolver.setPrefix(TEMPLATE_RESOLVER_PREFIX);
        templateResolver.setSuffix(TEMPLATE_RESOLVER_SUFFIX);
        templateResolver.setTemplateMode(TEMPLATE_RESOLVER_TEMPLATE_MODE);

        return templateResolver;
    }

    /**
     * Configure the property source
     * 
     * @return
     */
    @Bean
    public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() {
        return new PropertySourcesPlaceholderConfigurer();
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/resources/**").addResourceLocations("/resources/static/assets/");
    }

}

以下是收到的所有异常:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'org.thymeleaf.standard.processor.text.StandardTextInliningTextProcessor'
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:158)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:206)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:121)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:100)



root cause
org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'org.thymeleaf.standard.processor.text.StandardTextInliningTextProcessor'
    org.thymeleaf.processor.AbstractProcessor.process(AbstractProcessor.java:225)
    org.thymeleaf.dom.Node.applyNextProcessor(Node.java:1017)
    org.thymeleaf.dom.Node.processNode(Node.java:972)
    org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:695)
    org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:668)
    org.thymeleaf.dom.Node.processNode(Node.java:990)
    org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:695)
    org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:668)
    org.thymeleaf.dom.Node.processNode(Node.java:990)
    org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:695)
    org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:668)
    org.thymeleaf.dom.Node.processNode(Node.java:990)
    org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:695)
    org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:668)
    org.thymeleaf.dom.Node.processNode(Node.java:990)
    org.thymeleaf.dom.Document.process(Document.java:93)
    org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1155)
    org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1060)
    org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1011)
    org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView.java:335)
    org.thymeleaf.spring4.view.ThymeleafView.render(ThymeleafView.java:190)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1228)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1011)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:955)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:158)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:206)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:121)


root cause
java.lang.IllegalArgumentException: Could not perform introspection on object of class org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone
    org.thymeleaf.util.JavaScriptUtils.printObject(JavaScriptUtils.java:368)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:184)
    org.thymeleaf.util.JavaScriptUtils.printKeyValue(JavaScriptUtils.java:347)
    org.thymeleaf.util.JavaScriptUtils.printMap(JavaScriptUtils.java:338)
    org.thymeleaf.util.JavaScriptUtils.printObject(JavaScriptUtils.java:366)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:184)
    org.thymeleaf.util.JavaScriptUtils.printKeyValue(JavaScriptUtils.java:347)
    org.thymeleaf.util.JavaScriptUtils.printMap(JavaScriptUtils.java:338)
    org.thymeleaf.util.JavaScriptUtils.printObject(JavaScriptUtils.java:366)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:184)
    org.thymeleaf.util.JavaScriptUtils.printKeyValue(JavaScriptUtils.java:347)
    org.thymeleaf.util.JavaScriptUtils.printMap(JavaScriptUtils.java:338)
    org.thymeleaf.util.JavaScriptUtils.printObject(JavaScriptUtils.java:366)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:184)
    org.thymeleaf.util.JavaScriptUtils.printKeyValue(JavaScriptUtils.java:347)
    org.thymeleaf.util.JavaScriptUtils.printMap(JavaScriptUtils.java:338)
    org.thymeleaf.util.JavaScriptUtils.printObject(JavaScriptUtils.java:366)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:184)
    org.thymeleaf.util.JavaScriptUtils.printCollection(JavaScriptUtils.java:323)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:173)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:56)
    org.thymeleaf.standard.inliner.StandardJavaScriptTextInliner.formatEvaluationResult(StandardJavaScriptTextInliner.java:46)
    org.thymeleaf.standard.inliner.AbstractStandardScriptingTextInliner.processScriptingVariableInline(AbstractStandardScriptingTextInliner.java:294)
    org.thymeleaf.standard.inliner.AbstractStandardScriptingTextInliner.processScriptingInline(AbstractStandardScriptingTextInliner.java:90)
    org.thymeleaf.standard.inliner.AbstractStandardScriptingTextInliner.inline(AbstractStandardScriptingTextInliner.java:76)
    org.thymeleaf.standard.processor.text.StandardTextInliningTextProcessor.processTextNode(StandardTextInliningTextProcessor.java:93)
    org.thymeleaf.processor.text.AbstractTextNodeProcessor.doProcess(AbstractTextNodeProcessor.java:69)
    org.thymeleaf.processor.AbstractProcessor.process(AbstractProcessor.java:212)
    org.thymeleaf.dom.Node.applyNextProcessor(Node.java:1017)
    org.thymeleaf.dom.Node.processNode(Node.java:972)
    org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:695)
    org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:668)
    org.thymeleaf.dom.Node.processNode(Node.java:990)
    org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:695)
    org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:668)
    org.thymeleaf.dom.Node.processNode(Node.java:990)
    org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:695)
    org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:668)
    org.thymeleaf.dom.Node.processNode(Node.java:990)
    org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:695)
    org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:668)
    org.thymeleaf.dom.Node.processNode(Node.java:990)
    org.thymeleaf.dom.Document.process(Document.java:93)
    org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1155)
    org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1060)
    org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1011)
    org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView.java:335)
    org.thymeleaf.spring4.view.ThymeleafView.render(ThymeleafView.java:190)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1228)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1011)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:955)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:158)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)


root cause
java.lang.IllegalAccessException: Class org.thymeleaf.util.JavaScriptUtils can not access a member of class org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone with modifiers "public"
    sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
    java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:296)
    java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:288)
    java.lang.reflect.Method.invoke(Method.java:491)
    org.thymeleaf.util.JavaScriptUtils.printObject(JavaScriptUtils.java:361)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:184)
    org.thymeleaf.util.JavaScriptUtils.printKeyValue(JavaScriptUtils.java:347)
    org.thymeleaf.util.JavaScriptUtils.printMap(JavaScriptUtils.java:338)
    org.thymeleaf.util.JavaScriptUtils.printObject(JavaScriptUtils.java:366)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:184)
    org.thymeleaf.util.JavaScriptUtils.printKeyValue(JavaScriptUtils.java:347)
    org.thymeleaf.util.JavaScriptUtils.printMap(JavaScriptUtils.java:338)
    org.thymeleaf.util.JavaScriptUtils.printObject(JavaScriptUtils.java:366)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:184)
    org.thymeleaf.util.JavaScriptUtils.printKeyValue(JavaScriptUtils.java:347)
    org.thymeleaf.util.JavaScriptUtils.printMap(JavaScriptUtils.java:338)
    org.thymeleaf.util.JavaScriptUtils.printObject(JavaScriptUtils.java:366)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:184)
    org.thymeleaf.util.JavaScriptUtils.printKeyValue(JavaScriptUtils.java:347)
    org.thymeleaf.util.JavaScriptUtils.printMap(JavaScriptUtils.java:338)
    org.thymeleaf.util.JavaScriptUtils.printObject(JavaScriptUtils.java:366)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:184)
    org.thymeleaf.util.JavaScriptUtils.printCollection(JavaScriptUtils.java:323)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:173)
    org.thymeleaf.util.JavaScriptUtils.print(JavaScriptUtils.java:56)
    org.thymeleaf.standard.inliner.StandardJavaScriptTextInliner.formatEvaluationResult(StandardJavaScriptTextInliner.java:46)
    org.thymeleaf.standard.inliner.AbstractStandardScriptingTextInliner.processScriptingVariableInline(AbstractStandardScriptingTextInliner.java:294)
    org.thymeleaf.standard.inliner.AbstractStandardScriptingTextInliner.processScriptingInline(AbstractStandardScriptingTextInliner.java:90)
    org.thymeleaf.standard.inliner.AbstractStandardScriptingTextInliner.inline(AbstractStandardScriptingTextInliner.java:76)
    org.thymeleaf.standard.processor.text.StandardTextInliningTextProcessor.processTextNode(StandardTextInliningTextProcessor.java:93)
    org.thymeleaf.processor.text.AbstractTextNodeProcessor.doProcess(AbstractTextNodeProcessor.java:69)
    org.thymeleaf.processor.AbstractProcessor.process(AbstractProcessor.java:212)
    org.thymeleaf.dom.Node.applyNextProcessor(Node.java:1017)
    org.thymeleaf.dom.Node.processNode(Node.java:972)
    org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:695)
    org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:668)
    org.thymeleaf.dom.Node.processNode(Node.java:990)
    org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:695)
    org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:668)
    org.thymeleaf.dom.Node.processNode(Node.java:990)
    org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:695)
    org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:668)
    org.thymeleaf.dom.Node.processNode(Node.java:990)
    org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:695)
    org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:668)
    org.thymeleaf.dom.Node.processNode(Node.java:990)
    org.thymeleaf.dom.Document.process(Document.java:93)
    org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1155)
    org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1060)
    org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1011)
    org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView.java:335)
    org.thymeleaf.spring4.view.ThymeleafView.render(ThymeleafView.java:190)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1228)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1011)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:955)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:158)

我试图删除 LocationList<User> Event 中的字段对象,但错误仍然存​​在。我也尝试改变DateTimeDate还有一个String (假设转换 DateTime 时出错)但错误仍然存​​在(但可能做得不正确)。

最佳答案

也许这不是一个解决方案,但它对我有用。尝试用小写字母输入所有变量。似乎 Thymeleaf 不能很好地处理中间有大写字母的变量。就像 roomNumber eventList

关于javascript - Thymeleaf 对象到 Javascript 对象错误 : TemplateProcessingException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38030604/

相关文章:

java - 将变量从 JSP 传递到另一个 JSP

java - Errors/BindingResult 参数应在模型属性、@RequestBody 或 @RequestPart 参数之后立即声明

java - PropertySourcesPlaceholderConfigurer 和 PropertyPlaceholderConfigurer

javascript - jQuery .val()/.text() 不适用于特定的 html block

java - Postgresql JDBC 驱动程序中的批量更新在自动提交中回滚

java - 如何在不使用集合的情况下从 Java 中的给定数组中删除重复元素

java - 如何使用特殊字符& |和 Split() 方法中的⊕?

javascript - 使用 PhantomJS 从 CouchDB 获取文档

javascript - 如何使用 Vue.js 访问 API?

javascript - 用 html 中的文本替换 Swiper 分页