componentssap-commerce-cloudbackoffice

Global messages in Hybris


In cart page there is a custom component to display the wishlist items. Can I use global error message to display the messages in the custom component. I have tried displaying the same in custom component.But the error message is not getting displayed. Is it possible to use the global message in custom component.?


Solution

  • Yes, you can use global messages in custom CMS components.

    1. Include globalMessages tag in the customcomponent.jsp

      <%@ taglib prefix="common" tagdir="/WEB-INF/tags/responsive/common"%>

      <common:globalMessages />

    2. Add the error message in the fillmodel() method of your CustomComponentController.java

          GlobalMessages.addErrorMessage(model, "your.error.msg.key");