Struts 2 2.1 and Ajax

Source: Internet
Author: User
Tags builtin

2009-08-03
An error in Ajax DWR
When using DWR (struts2.1.6), for example, form or verification, the following errors may sometimes occur:

Freemarker template error!

Expression parameters. parsecontent is undefined on line 45, column 28 in template/ajax/head. FTL.
The problematic instruction:
----------
==>$ {Parameters. parsecontent? String} [on line 45, column 26 in template/ajax/head. FTL]
----------

 

All errors are as follows:

Freemarker template error!

Expression parameters. parsecontent is undefined on line 45, column 28 in template/ajax/head. FTL.
The problematic instruction:
----------
==>$ {Parameters. parsecontent? String} [on line 45, column 26 in template/ajax/head. FTL]
----------

Java backtrace for programmers:
----------
Freemarker. Core. invalidreferenceexception: expression parameters. parsecontent is undefined on line 45, column 28 in template/ajax/head. FTL.
At freemarker. Core. templateobject. assertnonnull (templateobject. Java: 124)
At freemarker. Core. templateobject. invalidtypeexception (templateobject. Java: 134)
At freemarker. Core. builtin $ stringbi. _ getastemplatemodel (builtin. Java: 358)
At freemarker. Core. expression. getastemplatemodel (expression. Java: 89)
At freemarker. Core. expression. getstringvalue (expression. Java: 93)
At freemarker. Core. dollarvariable. Accept (dollarvariable. Java: 76)
At freemarker. Core. environment. Visit (environment. Java: 208)
At freemarker. Core. mixedcontent. Accept (mixedcontent. Java: 92)
At freemarker. Core. environment. Visit (environment. Java: 208)
At freemarker. Core. environment. Process (environment. Java: 188)
At freemarker. template. Template. process (Template. java: 237)
At org. apache. struts2.components. template. FreemarkerTemplateEngine. renderTemplate (FreemarkerTemplateEngine. java: 185)
At org. apache. struts2.components. UIBean. mergeTemplate (UIBean. java: 558)
At org. apache. struts2.components. UIBean. end (UIBean. java: 512)
At org. apache. struts2.views. jsp. ComponentTagSupport. doEndTag (ComponentTagSupport. java: 42)
At org. apache. jsp. web. bbs. quiz_002dajax_jsp. _ jspx_meth_s_005fhead_005f0 (quiz_002dajax_jsp.java: 111)
At org. apache. jsp. web. bbs. quiz_002dajax_jsp. _ jspService (quiz_002dajax_jsp.java: 74)
At org. apache. jasper. runtime. HttpJspBase. service (HttpJspBase. java: 70)
At javax. servlet. http. HttpServlet. service (HttpServlet. java: 803)
At org. apache. jasper. servlet. JspServletWrapper. service (JspServletWrapper. java: 374)
At org. apache. jasper. servlet. JspServlet. serviceJspFile (JspServlet. java: 337)
At org. apache. jasper. servlet. JspServlet. service (JspServlet. java: 266)
At javax. servlet. http. HttpServlet. service (HttpServlet. java: 803)
At org. apache. catalina. core. ApplicationFilterChain. internalDoFilter (ApplicationFilterChain. java: 290)
At org. apache. catalina. core. ApplicationFilterChain. doFilter (ApplicationFilterChain. java: 206)
At org. apache. struts2.dispatcher. FilterDispatcher. doFilter (FilterDispatcher. java: 461)
At org. apache. catalina. core. ApplicationFilterChain. internalDoFilter (ApplicationFilterChain. java: 235)
At org. apache. catalina. core. ApplicationFilterChain. doFilter (ApplicationFilterChain. java: 206)
At org. apache. struts2.dispatcher. ActionContextCleanUp. doFilter (ActionContextCleanUp. java: 97)
At org. apache. catalina. core. ApplicationFilterChain. internalDoFilter (ApplicationFilterChain. java: 235)
At org. apache. catalina. core. ApplicationFilterChain. doFilter (ApplicationFilterChain. java: 206)
At share. filter. EncodingFilter. doFilter (EncodingFilter. java: 31)
At org. apache. catalina. core. ApplicationFilterChain. internalDoFilter (ApplicationFilterChain. java: 235)
At org. apache. catalina. core. ApplicationFilterChain. doFilter (ApplicationFilterChain. java: 206)
At org. tuckey. web. filters. urlrewrite. RuleChain. handleRewrite (RuleChain. java: 164)
At org. tuckey. web. filters. urlrewrite. RuleChain. doRules (RuleChain. java: 141)
At org. tuckey. web. filters. urlrewrite. UrlRewriter. processRequest (UrlRewriter. java: 90)
At org. tuckey. web. filters. urlrewrite. UrlRewriteFilter. doFilter (UrlRewriteFilter. java: 406)
At org. apache. catalina. core. ApplicationFilterChain. internalDoFilter (ApplicationFilterChain. java: 235)
At org. apache. catalina. core. ApplicationFilterChain. doFilter (ApplicationFilterChain. java: 206)
At org. cndoctors. servlet. HibernateFilter. doFilter (HibernateFilter. java: 38)
At org. apache. catalina. core. ApplicationFilterChain. internalDoFilter (ApplicationFilterChain. java: 235)
At org. apache. catalina. core. ApplicationFilterChain. doFilter (ApplicationFilterChain. java: 206)
At org. apache. catalina. core. StandardWrapperValve. invoke (StandardWrapperValve. java: 233)
At org. apache. catalina. core. StandardContextValve. invoke (StandardContextValve. java: 175)
At org. apache. catalina. core. StandardHostValve. invoke (StandardHostValve. java: 128)
At org. apache. catalina. valves. ErrorReportValve. invoke (ErrorReportValve. java: 102)
At org. Apache. Catalina. Core. standardenginevalve. Invoke (standardenginevalve. Java: 109)
At org. Apache. Catalina. connector. coyoteadapter. Service (coyoteadapter. Java: 286)
At org. Apache. Coyote. http11.http11processor. Process (http11processor. Java: 844)
At org. Apache. Coyote. http11.http11protocol $ http11connectionhandler. Process (http11protocol. Java: 583)
At org.apache.tomcat.util.net. jioendpoint $ worker. Run (jioendpoint. Java: 447)
At java. Lang. thread. Run (thread. Java: 595)

 

Solution:

1: Add a struts2-dojo-plugin.jar in the project
2: add

<% @ Taglib prefix = "SX" uri = "/Struts-Dojo-tags" %>

3: Change <s: Head theme = "ajax"/> to <SX: Head/>

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.