Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macros 关于在Freemarker文件中使用Struts2 Include标记的问题_Macros_Struts2_Jsp Tags_Freemarker_Oscache - Fatal编程技术网

Macros 关于在Freemarker文件中使用Struts2 Include标记的问题

Macros 关于在Freemarker文件中使用Struts2 Include标记的问题,macros,struts2,jsp-tags,freemarker,oscache,Macros,Struts2,Jsp Tags,Freemarker,Oscache,以下是我的场景: 1、 实际上,变量id类似于blowTestAction.java: 2、 web.xml中的配置: 我的代码有什么问题吗 据我所知,您正在尝试显示TestAction对象,而不是ID 尝试这样做: 或者在您目前的情况下: ${id.id} 这相当于: (new TestAction()).getId() 或 Taka请看下面的答案: 此链接: 由于您没有发布整个Action类,很难说您将哪些模型数据放入操作中。感谢您的回复:添加了num变量设置代码。 … <@s

以下是我的场景:

1、 实际上,变量id类似于blowTestAction.java: 2、 web.xml中的配置:
我的代码有什么问题吗

据我所知,您正在尝试显示TestAction对象,而不是ID

尝试这样做:

或者在您目前的情况下:

${id.id}
这相当于:

(new TestAction()).getId()

Taka请看下面的答案:

此链接:


由于您没有发布整个Action类,很难说您将哪些模型数据放入操作中。

感谢您的回复:添加了num变量设置代码。
…
  <@s.include value="/invitation/inviter"/><#-- there is no variable id in this action -->
…
  <span>${id}<span>
…
Error on line 63, column 61 in WEB-INF/ftl/invitation/ test.ftl
Expecting a string, date or number here, Expression id!0 is instead a freemarker.ext.beans.ArrayModel
The problematic instruction:
----------
==> ${id} [on line 63, column 59 in WEB-INF/ftl/invitation/test.ftl]
in user-directive page [on line 1, column 1 in WEB-INF/ftl/invitation/ test.ftl]
----------

Java backtrace for programmers:
----------
freemarker.core.NonStringException: Error on line 63, column 61 in WEB-INF/ftl/invitation/ test.ftl
Expecting a string, date or number here, Expression id!0 is instead a freemarker.ext.beans.ArrayModel
         at freemarker.core.Expression.getStringValue(Expression.java:126)
         at freemarker.core.Expression.getStringValue(Expression.java:93)
         at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
         at freemarker.core.Environment.visit(Environment.java:210)
${testAction.id}
${id.id}
(new TestAction()).getId()
existingTestAction.getId()