For administration applications, the title should be moved to the inner views of the app and the associated back link should be moved to the portlet titles. If you open the Blogs Admin application in the Control Panel and add a new blog entry, you’ll see this behavior in action:
Figure 1: Adding a new blog entry displays the portlet title at the top, along with a back link.
The Blogs Admin application is used as an example throughout this article. Follow these steps to configure your app’s title and back URL:
-
Use
ParamUtil
to retrieve the redirect for the URL:String redirect = ParamUtil.getString(request, "redirect");
-
Display the back icon and set the back URL to the
redirect
:portletDisplay.setShowBackIcon(true); portletDisplay.setURLBack(redirect);
-
Finally, set the title using the
renderResponse.setTitle()
method. The example below provides a title for two scenarios:- If an existing blog entry is being updated, the blog’s title is displayed.
- Otherwise it defaults to New Blog Entry since a new blog entry is being created.
renderResponse.setTitle((entry != null) ? entry.getTitle() : LanguageUtil.get(request, "new-blog-entry")); %>
-
Update any back links in the view to use the
redirect
. The Blog Admin app’sedit_entry.jsp
form’s cancel button is shown below as an example:<aui:button cssClass="btn-lg" href="<%= redirect %>" name="cancelButton" type="cancel" />
Great! Now you know how to configure your app’s title and back URL.