【问题标题】:Liferay portlet with freemarker and spring带有 freemarker 和 spring 的 Liferay portlet
【发布时间】:2014-09-27 01:06:23
【问题描述】:

我正在使用带有 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。如何在免费标记中使用这个标签?

【问题讨论】:

    标签: liferay-6 freemarker spring-portlet-mvc


    【解决方案1】:

    喜欢&lt;@aui['model-context'] bean=...&gt;。 (因为foo.bar等价于foo['bar'],而@之后的东西只是一个通用的FTL表达式。)

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-09
      • 2018-02-08
      • 2019-02-16
      • 2017-01-30
      • 2021-02-03
      • 1970-01-01
      相关资源
      最近更新 更多