如何在Liferay 7中用html显示页面

liferay portlet默认的显示页面是view.jsp,虽然可以在jsp中用include标签包括html文件,但是如何直接通过修改配置文件让默认的显示页面为view.html呢?

1.用Liferay IDE建一个mvc-portlet,打开其中的java代码,把@Component内容改成如下所示

@Component(
     immediate = true,
     property = {
         "com.liferay.portlet.display-category=category.sample",
         "com.liferay.portlet.instanceable=true",
         "javax.portlet.display-name=test Portlet",
         "javax.portlet.init-param.template-path=/",
         "javax.portlet.init-param.view-template=/view.html",
        "javax.portlet.init-param.valid-paths=/view.html",
        "javax.portlet.resource-bundle=content.Language",
       "javax.portlet.security-role-ref=power-user,user"
   },
    service = Portlet.class
)
public class TestPortlet extends MVCPortlet {       
}

就是这个样纸啦

原文地址:https://www.cnblogs.com/hibou/p/6833520.html