1

我正在使用带有 FreeMarker 模板引擎(v2.3.14)的 spring portlet mvc(v3.2.9)为 liferay 门户(v6.2)开发简单的 portlet。我使用 portlet 和 aui taglibs 来创建页面

<#assign portlet=JspTaglibs["http://java.sun.com/portlet"]> 
<#assign aui=JspTaglibs["http://liferay.com/tld/aui"]>

这些标签在大多数情况下都有效,但我对以下代码有疑问

<@aui.form action="${editPreferencesUrl}">
    <@aui.model-context bean="${myBean}" />
    <@aui.input name="name"  />
    <@aui.input name="surname" />
</@aui.form>

我得到以下异常

javax.portlet.PortletException: org.springframework.web.util.NestedServletException: View rendering failed; nested exception is freemarker.core.NonNumericalException: Error on line 8, column 11 in preferences.ftl
Expression aui.model is not numerical
Expression context is not numerical

我正在关注本教程http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Alloy+UI+Forms+(aui)/pop_up?_36_version=1.9

问题肯定是@aui.model-context。如何在免费标记中使用此标签?

4

1 回答 1

1

喜欢<@aui['model-context'] bean=...>。(因为,foo.bar等价于foo['bar'],而后面@的只是一个通用的 FTL 表达式。)

顺便说一句,那些"${expression}"-s 是必要的吗?你必须在那里转换成字符串吗?因为否则你应该只写action=editPreferencesUrl等等。

于 2014-08-04T21:00:32.630 回答