Grails 1.2.1 と grails-portlets 0.7 および grails-portlets-liferay 0.2 プラグインを使用して、Liferay 5.2.2 用の単純なポートレットを作成しようとしています。
ストック・ポートレットを作成してデプロイしました (タイトル、説明などを更新しました...)。正しくデプロイされ、ビューが正しくレンダリングされます。ただし、その中にあるデフォルトのフォームを送信すると、関数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']
}
...
}
ビュー.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>
In render view
ポートレットを表示するたびに、送信ボタンを押した後、 Tomcat ターミナルが印刷されます。In action view
ステートメントを出力することはありません。
何か案は?
アップデート
ロギングをオンにすると、ポートレットで送信ボタンをクリックすると次のように表示されます。
[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
そのログ スニペットの 4 行目にはBound render request...と書かれていますが、ポートレットにあるフォームのアクションがアクション URL に対するものであるため、わかりません。私はそれが行動要求であるべきだと思っていたでしょう。