Liferay Struts Portlet 1

 1.Define the Portlet

potlet-ext.xml

<portlet>
    <portlet-name>EXT_4</portlet-name>
    <display-name>Library Portlet</display-name>
    <portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
    <init-param>
        <name>view-action</name>
        <value>/ext/library/view</value>
    </init-param>
    <expiration-cache>0</expiration-cache>
    <supports>    
        <mime-type>text/html</mime-type>
    </supports>
    <resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
    <security-role-ref>
        <role-name>power-user</role-name>
    </security-role-ref>
    <security-role-ref>
        <role-name>user</role-name>
    </security-role-ref>
</portlet>

liferay-portlet-ext.xml

< portlet >
    
< portlet-name > EXT_4 </ portlet-name >
    
< struts-path > ext/library </ struts-path >
    
< use-default-template > false </ use-default-template >
</ portlet >

2.Define the page flow and layout

struts-config.xml

< action  path ="/ext/library/view"  forward ="portlet.ext.library.view"   />

 tiles-defs.xml

< definition  name ="portlet.ext.library"  extends ="portlet"   />

< definition  name ="portlet.ext.library.view"  extends ="portlet.ext.library" >
    
< put  name ="portlet_content"  value ="/portlet/ext/library/view.jsp"   />
</ definition >

3.Create the JSP in .../ext/ext-web/docroot/html/portlet/ext/library/

init.jsp

<% @ include file="/html/common/init.jsp"  %>
    
< p > Add commonly used variables and declarations here! </ p >

view.jsp

<% @ include file="/html/portlet/ext/library/init.jsp"  %>
Simple struts portlet!

4.Set the Portlet Title

go to .../ext/ext-ejb/classes/content/Language-ext.properties, add:

javax.portlet.title.EXT_4=Library

5.Add the Portlet to a Caterory

go to .../ext/ext-web/docroot/WEB-INF/liferay-display.xml, add:

<category name="category.test">
      <portlet id="EXT_1" />
      <portlet id="EXT_4" />
      ...
 </category>

...

Finally,

.../ext>ant deploy

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值