【问题标题】:Grails Liferay portlet not invoking actionGrails Liferay portlet 不调用操作
【发布时间】:2010-02-12 18:23:10
【问题描述】:

我正在尝试使用带有 grails-portlets 0.7 和 grails-portlets-liferay 0.2 插件的 Grails 1.2.1 为 Liferay 5.2.2 创建一个简单的 portlet。

我创建并部署了一个常用的 portlet(刚刚更新了标题、描述等...)。它正确部署并且视图正确呈现。但是,当我提交 view.gsp 中的默认表单时,它永远不会命中 actionView 函数。

以下是相关代码位:

SearchPortlet.groovy

class SearchPortlet {

  def title = 'Search'
  def description = '''
A simple search portlet.
'''
  def displayName = 'Search'
  def supports = ['text/html':['view', 'edit', 'help']]

  // Liferay server specific configurations
  def liferay_display_category = 'Category'

  def actionView = {
    println "In action view"
  }

  def renderView = {
    println "In render view"
    //TODO Define render phase. Return the map of the variables bound to the view
    ['mykey':'myvalue']
  }

  ...
}

view.gsp

<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<div>
<h1>View Page</h1>
The map returned by renderView is passed in. Value of mykey: ${mykey}
<form action="${portletResponse.createActionURL()}">
    <input type="submit" value="Submit"/>
</form>
</div>

每当我查看portlet 时以及在我按下提交 按钮后,tomcat 终端都会打印In render view。它从不打印In action view 语句。

有什么想法吗?

更新

我打开了日志记录,这就是我在单击 portlet 中的 submit 按钮时看到的内容:

[localhost].[/gportlet]  - servletPath=/Search, pathInfo=/invoke, queryString=null, name=null
[localhost].[/gportlet]  -  Path Based Include
portlets.GrailsDispatcherPortlet  - DispatcherPortlet with name 'Search' received render request
portlets.GrailsDispatcherPortlet  - Bound render request context to thread: com.liferay.portlet.RenderRequestImpl@7a158e
portlets.GrailsDispatcherPortlet  - Testing handler map [org.codehaus.grails.portlets.GrailsPortletHandlerMapping@1f06283] in DispatcherPortlet with name 'Search'
portlets.GrailsDispatcherPortlet  - Testing handler adapter [org.codehaus.grails.portlets.GrailsPortletHandlerAdapter@74f72b]
portlets.GrailsPortletHandlerAdapter  - portlet.handleMinimised not set, proceeding with normal render
portlet.SearchPortlet  - In render view
portlets.GrailsPortletHandlerAdapter  - Couldn't resolve action view /search/null.gsp
portlets.GrailsPortletHandlerAdapter  - Trying to render mode view /search/view.gsp
portlets.GrailsDispatcherPortlet  - Setting portlet response content type to view-determined type [text/html;charset=ISO-8859-1]
[localhost].[/gportlet]  - servletPath=/WEB-INF/servlet/view, pathInfo=null, queryString=null, name=null
[localhost].[/gportlet]  -  Path Based Include
portlets.GrailsDispatcherPortlet  - Cleared thread-bound render request context: com.liferay.portlet.RenderRequestImpl@7a158e
portlets.GrailsDispatcherPortlet  - Successfully completed request

该日志 sn-p 中的第四行说 Bound render request...,我不明白,因为 portlet 中表单中的操作是针对操作 url。我原以为这应该是一个行动请求。

【问题讨论】:

    标签: grails portlet liferay grails-plugin


    【解决方案1】:

    我也有同样的问题,如果能让它工作会非常好。

    更新

    我在表单中添加了method="post",它就像一个魅力:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-06-17
      • 1970-01-01
      • 2019-06-08
      • 2015-01-27
      • 2018-09-11
      • 2011-10-28
      • 1970-01-01
      相关资源
      最近更新 更多