legacy-knowledge-base
公開されました Sep. 10, 2025

同じ WAR ファイルに複数の Spring MVC ポートレット名を追加すると、[ウィジェットの追加] メニューに複数の Spring MVC ポートレット名が表示されない

written-by

Justin Mann

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

  • カスタム ウィジェットを作成するときに、複数のウィジェットが同じ war ファイル内にデプロイされている場合、ウィジェットの個々の名前が Liferay 内の [ウィジェットの追加] メニューに表示されません。
  • 代わりに、各ウィジェットは同じ名前を共有します

Environment

  • Liferay DXP 7.3

解決策

  • これは、Language.properties ファイルでウィジェット固有の名前が定義されていない場合に発生します。
  • ウィジェットの名前を取得するとき、次のコードが実行されます: https://github.com/liferay/liferay-portal/blob/7.3.x/portal-impl/src/com/liferay/portal/util/PortalImpl .java#L8599-L8617. Liferay は に言語ファイルを検索して、WAR ファイルにデプロイされた各ウィジェットに固有のキーを探します。
  • たとえば、次の 2 つのキーを探している可能性があります:
    javax.portlet.title.testportlet_WAR_testportlet
    javax.portlet.title.myportlet_WAR_testportlet
  • これらが Language.properties ファイルで定義されていない場合、Liferay はデフォルトで定義された一般的なタイトル キーにフォールバックします:
    javax.portlet.title=test-portlet
    これが、両方のウィジェットが [ウィジェットの追加] メニューに一般的なタイトルを表示する理由です。
  • 固有のタイトルを表示するには、次のキー (例を示します) を /test-portlet/src/main/resources/content/Language.properties に追加する必要があります
    javax.portlet.title.testportlet_WAR_testportlet=The Test Portlet Title
    javax.portlet.title.myportlet_WAR_testportlet=The My Portlet Title
    このファイルは通常、/WEB-INF/classes/content/Language.properties にあります。
did-this-article-resolve-your-issue

legacy-knowledge-base