在struts-2.2.3.1中加入這個標籤,報錯

來源:互聯網
上載者:User
    在已經引入/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.TemplateObjectFile: 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"/>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.