Add Portlet Progress Bar
A progress bar is one of the most useful widgets for a user interface when the user can perform lengthy tasks. Unfortunately, while it's a widget very often found in desktop applications it's not so common in web applications. The reason for this is that it's not so obvious how to implement them.
This article shows how easy it's to add an bar to show the progress of a file upload in Liferay.
How to add the progress bar to your own portlet #
Simply add the following taglib invocation at the end of the JSP:
<liferay-ui:upload-progress id="<%= uploadProgressId %>" message="uploading" redirect="<%= HtmlUtil.escape(redirect) %>" />
<input type="submit" value="<liferay-ui:message key="upload" />" onClick="<%= uploadProgressId %>.startProgress(); return true;"/>
Note that the value of uploadProgressId can be any String but it must be unique. One way to generate a unique String is:
String uploadProgressId = PwdGenerator.getPassword(PwdGenerator.KEY3, 4);
How this works #