How Portlet Container displays Portlet title



Introduction:-
Portlet has it's own name displaying on Left Top corner in a Portlet Window.

We define portlet title with title tag inside portlet-info, defined in portlet.xml.
<portlet-info>

<title>EMail</title>
<short-title>EMail</short-title>
<keywords>EMail</keywords>
</portlet-info>

Title tag contains title of the portlet, in this case it is EMail.
Short title is used when title value is too long to display, which is generally used in such devices where UI area is limited, like portlet running on mobile devices.
Keywords tag is used to search the portlet before adding on portal page.


How Portlet Container pick up portlet title to display

Portlet Container first checks an entry of resource bundle
in portlet.xml, if it is present, container first look for portlet title in the corresponding resource bundle file.

Resource bundle entry in portlet.xml
<resource-bundle>com.mail.resourcebundle.mail</resource-bundle>
Resource bundle (mail_en.properties) will have following entry


javax.portlet.title= Email
javax.portlet.short-title= Email
javax.portlet.keywords= Email

So, if above entries are present, portlet container will pick up portlet title from resource bundle.

If resource bundle entry is not preset in portlet.xml, container looks for <title> tag inside <portlet-info> in portlet.xml and will show portlet title from <title> tag.

No comments: