hzzzyyy
hzzzyyy
2015-10-12 15:09

Struts2框架,s:form表单标签使用theme="ajax"报错

  • struts
  • 标签
  • 表单
  • 框架
  • ajax

已经导入struts2-dojo-plugin-2.3.24.1.jar,jsp页面如下:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>登录页面</title>
    <sx:head />
</head>

<body>
    <s:form action="Login" theme="ajax">
        <table width="60%" height="76" border="0">
            <s:textfield name="username" label="用户名" />
            <s:password name="password" label="密码" />
            <s:submit value="登录" align="center" />
        </table>
    </s:form>

</body>

报运行时以下错误:

FreeMarker template error (HTML_DEBUG mode; use RETHROW in production!)

The following has evaluated to null or missing:
==> parameters.pushId [in template "template/ajax/submit.ftl" at line 103, column 6]


Tip: It's the step after the last dot that caused this error, not those before it.

Tip: If the failing expression is known to be legally refer to something that's null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??


FTL stack trace ("~" means nesting-related):

- Failed at: #if parameters.pushId [in template "template/ajax/submit.ftl" at line 103, column 1]

Java stack trace (for programmers):

freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:116)
at freemarker.core.UnexpectedTypeException.newDesciptionBuilder(UnexpectedTypeException.java:60)
at freemarker.core.UnexpectedTypeException.(UnexpectedTypeException.java:40)
at freemarker.core.NonBooleanException.(NonBooleanException.java:44)
。。。

去掉则正常,感觉应该是submit少了什么属性,错误提示的parameters.pushId不知道是什么意思,submit应该没pushId属性吧,加上id,form加上name也没用,还是报错。

求大神指点!

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答