Success message and Error message in liferay


Success Message
   
              In Class   
                       SessionMessages.add(request, "record-updated");

               In JSP
                          <liferay-ui:success key="record-updated" message="record-updated-sucessfully" />

               Language.properties
                           record-updated  = Your record updated successfully.


           and also don't forget add following tag in portlet.xml after supports tag

                          <resource-bundle>content/Language</resource-bundle> 


Error Message

           In Class
                  SessionErrors.add(request,"cannot-delete-record");

               In JSP
                <liferay-ui:error key="cannot-delete-record">
                           <liferay-ui:message key=cannot-delete-this -record" />
               </liferay-ui:error>

               Language.properties
                           cannot-delete-this -record  = Your record cannot delete


Don't forget to add the resource bundle

Comments

  1. Need to delete success / Error message after some time using properties.

    ReplyDelete

Post a Comment

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate