掲示板

Wrong documentation for javax.portlet properties in the Liferay Wiki

6年前 に Thomas Kellerer によって更新されました。

Wrong documentation for javax.portlet properties in the Liferay Wiki

Expert 投稿: 490 参加年月日: 08/06/09 最新の投稿
The wiki page:
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/creating-an-mvc-portlet#render-logic
states:
the template-path property tells the MVC framework where your JSP files live

However, when I deploy a portlet using that property I get the following error in the logfile:

> [PortletTracker:1110] Invalid property javax.portlet.init-param.template-path for my_portlet

The same is true for javax.portlet.name and javax.portlet.init-param.view-template

> [PortletTracker:1110] Invalid property javax.portlet.name for portlet my_portlet
> [PortletTracker:1110] Invalid property javax.portlet.init-param.view-template for my_portlet

This is how my portlet is defined:
@Component(
	immediate = true,
	property = {
        "com.liferay.portlet.display-category=My Portlets",
        "com.liferay.portlet.instanceable=false",
        "javax.portlet.display-name=My Portlet",
        "javax.portlet.init-param.template-path=/my_portlet/",
        "javax.portlet.init-param.view-template=/display.jsp",
        "javax.portlet.name=my_portlet",
        "javax.portlet.resource-bundle=content.Language",
        "javax.portlet.security-role-ref=power-user,user",
        "javax.portlet.portlet-mode=text/html;edit",
	},
	service = Portlet.class
)


What am I missing here?

My portlet also doesn't display the JSP page - it only shows the Portlet header and nothing else.

In the logfile I can only see the following WARNing

> WARN [http-nio-8080-exec-7][BaseBodyTagSupport:81] BodyContent is not BodyContentWrapper. Check JspFactorySwapper.

but no errors.

This is with Liferay 7.0.3 GA4
thumbnail
6年前 に David H Nebinger によって更新されました。

RE: Wrong documentation for javax.portlet properties in the Liferay Wiki

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Thomas Kellerer:
What am I missing here?


Letting Liferay derive the portlet name is not safe because in previous versions the periods in the package name were left as periods, but in others they were converted to underscores.

Use an explicit portlet name so everything is happy.
https://web.liferay.com/web/user.26526/blog/-/blogs/proper-portlet-name-for-your-portlet-components-







Come meet me at the 2017 LSNA!
6年前 に Thomas Kellerer によって更新されました。

RE: Wrong documentation for javax.portlet properties in the Liferay Wiki

Expert 投稿: 490 参加年月日: 08/06/09 最新の投稿
David H Nebinger:
Letting Liferay derive the portlet name is not safe because in previous versions the periods in the package name were left as periods, but in others they were converted to underscores.


Well, I am setting the name. If you read the code from my initial question you will see this:
"javax.portlet.name=my_portlet",


But when deploying that Portlet Liferay complains that this is invalid:

> [PortletTracker:1110] Invalid property javax.portlet.name for portlet my_portlet

So I follow the recommendation and supply the name, but Liferay claims that property is invalid.

My point is that those property which are explicitly documented result in error messages from Liferay - one of them is wrong. Either Liferay or the documentation.
thumbnail
6年前 に David H Nebinger によって更新されました。

RE: Wrong documentation for javax.portlet properties in the Liferay Wiki

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Hmm, looks like it might have been changed to javax.portlet.portlet-name...

Give that one a try.


Okay, so I'm not sure why it is rejecting javax.portlet.name as the property key. I thought I was losing my head, but that key is still used throughout the portal.

javax.portlet.name is definitely the key, and it should work w/o throwing the invalid key thing.

And I just checked, that would only be logged as a warning message, it is not a critical failure that would stop the portlet from deploying/loading.







Come meet me at the 2017 LSNA!