Liferay7开发文档_3.4.3创建PORTLET KEYS

使用PortletKeys在一个地方管理重要的东西,比如如portlet名称或其他可重复使用的常量。这样,如果需要更改portlet的名称,可以在一个地方完成,然后在需要它的每个类中引用。Keys必须首先被组件属性引用,然后被类引用。

按照以下步骤创建应用程序PortletKeys

  1. In your guestbook-web module, open the GuestbookPortlet class and update the component class metadata properties by adding one new property:
    "javax.portlet.name=" + GuestbookPortletKeys.GUESTBOOK,
    

    Note that you need the trailing comma if you’ve added the property to the middle of the list. If you’ve added it to the end of the last, leave it off.

  2. Save GuestbookPortlet. It now shows an error because you haven’t added the key to the class.
  3. Open the com.liferay.docs.guestbook.constants package.
  4. Open GuestbookPortletKeys and create a public, static, final String called GUESTBOOK with a value of com_liferay_docs_guestbook_portlet_GuestbookPortlet:
    public static final String GUESTBOOK =
             "com_liferay_docs_guestbook_portlet_GuestbookPortlet";
    
  5. Save the file.

现在GuestbookPortlet的错误已经消失,应用程序可以重新部署。

接下来,将应用程序与使用Service Builder生成的新后端集成。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值