这个标签,报错">

在struts-2.2.3.1中加入这个标签,报错

    在已经引入/MyStruts/WebRoot/WEB-INF/lib/struts2-dojo-plugin-2.1.8.jar包的情况下,如果我使用<s:head theme="ajax"/>,会抛如下异常:
 Class: freemarker.core.TemplateObject File: TemplateObject.java
 Method: assertNonNull
如果我没有引入struts2-dojo-plugin-2.1.8.jar包会抛出如下异常:
Expression parameters.parseContent is undefined on line 45, column 28 in template/ajax/head.ftl. - Class: freemarker.core.TemplateObject
File: TemplateObject.java出错,后网上一查原因为出现此问题的原因:在jsp页面用到了struts提供的ajax主题,但是声明主题时出现问题,struts2.0到struts2.1有一个重要的改变就是对ajax支持的改变,struts2.0的ajax支持主要以DWR和dojo为主,并专门提供ajax主题,如:<s:head theme="ajax"/>,但是在struts2.1不在提供ajax主题,而将原来的ajax主题放入了dojo插件中,我们需要将dojo标签引入到jsp页面,
在改为<%@ taglib uri="/struts-tags" prefix="s" %> 
<%@ taglib uri="/struts-dojo-tags" prefix="sx" %>
<sx:head theme="ajax"/>会抛如下异常:
后又出现异常Attribute theme invalid for tag head according to TLD

解决办法:
<sx:head theme="ajax" />改成下面这两行,其他的不用改:
<s:head theme="xhtml"/>
<sx:head parseContent="true"/>

你可能感兴趣的:(在struts-2.2.3.1中加入这个标签,报错)