2012-06-18 34 views

回答

8

是的,你可以通過首先添加以下內容到portlet.xml中的「門戶」的子節點的做到這一點:

<init-param> 
     <name>config-jsp</name> 
     <value>/html/config.jsp</value> 
    </init-param> 

的在你的Liferay-portlet.xml中,你需要添加此作爲「門戶」的子節點:

<configuration-action-class>com.yourportlet.action.ConfigurationActionImpl</configuration-action-class> 

然後,你需要創建你已經在你的XML中指定的目錄這個文件,你ConfigurationActionImpl應該實現ConfigurationAction接口,這樣的骨架是這樣的:

public class ConfigurationActionImpl implements ConfigurationAction { 

@Override 
public String render(PortletConfig config, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception {     
    return "/html/config.jsp"; 
} 

讓我知道這是否有幫助,或者您有任何其他問題! :)

+0

這有助於一點點,但我還有其他問題:如果我在我的portlet類中實現ConfigurationAction,而不是創建一個新的類,是 com.yourportlet.action.ConfigurationActionImpl變成了 com.yourportlet.action.myportletclass? ps:我不能投票,因爲我的名譽(少15),但感謝 –

+0

你不希望你的portlet實現ConfigurationAction(事實上我不知道這是否會工作或不),因爲你想如果有意義,請將此邏輯與您的Portlet代碼分開。您最好爲Configuration和Portlet創建單獨的類。 – Jonny

+0

如果有效,那麼只需接受答案,不用擔心投票! :)如果您還有其他問題,請詢問! – Jonny

1

添加編輯模式下您的portlet.xml:

<supports> 
     <mime-type>text/html</mime-type> 
     <portlet-mode>view</portlet-mode> 
     <portlet-mode>edit</portlet-mode> <!-- add this line --> 
    </supports> 

然後你會看到菜單中的首選項。覆蓋您的portlet類中的doEdit方法以呈現編輯模式的內容。

編輯:

更先進的解決方案:

您可以通過鉤門戶JSP改變添加另一個選項卡。您需要更改的JSP是:

/html/portlet/portlet_configuration/tabs1.jsp

注意,這將改變配置窗口所有portlet。

+0

我真的這樣做了喜好菜單?我想我可以像我在圖片鏈接(編輯我的問題)。 –

相關問題