| | I created a directory for each portlet that I created. Then I put the jsp page in that directory with the name of view.jsp. If I had to initialize any variables (which was in the init.jsp in the shopping portlet) I created a new init.jsp. Of course I had to add entries in the web.xml file as well. Then I created an entry in portlet.xml and liferay-portlet.xml.
It was basically trial and error to see what errors I received while trying to use each component.
For example: Checkout: I still have a checkout_first.jsp, checkout_second.jsp and a checkout_third.jsp. But my main page is view.jsp and I have an init.jsp page.
The init.jsp page has the following:
<%@ include file="/html/portlet/webstore/init.jsp" %>
<portlet:defineObjects />
<liferay-theme:defineObjects />
<% PortalPreferences portalPrefs = PortletPreferencesFactoryUtil.getPortalPreferences(request);
StorefrontPreferences storefrontPrefs = StorefrontPreferences.getInstance(company.getCompanyId(), portletGroupId.longValue());
Currency currency = Currency.getInstance(storefrontPrefs.getCurrencyId());
NumberFormat currencyFormat = NumberFormat.getCurrencyInstance(locale);
currencyFormat.setCurrency(currency);
DateFormat dateFormatDateTime = DateFormats.getDateTime(locale, timeZone);
NumberFormat doubleFormat = NumberFormat.getNumberInstance(locale);
doubleFormat.setMaximumFractionDigits(2); doubleFormat.setMinimumFractionDigits(2);
NumberFormat percentFormat = NumberFormat.getPercentInstance(locale);
NumberFormat taxFormat = NumberFormat.getPercentInstance(locale);
taxFormat.setMinimumFractionDigits(3);
WindowState windowState = null; PortletMode portletMode = null;
if (renderRequest != null) { windowState = renderRequest.getWindowState(); portletMode = renderRequest.getPortletMode(); } else if (resourceRequest != null) { windowState = resourceRequest.getWindowState(); portletMode = resourceRequest.getPortletMode(); }
String currentURL = PortalUtil.getCurrentURL(request); %> |
| Please sign in to flag this as inappropriate. |