I have a portlet in liferay that shows list of items and allow to add/edit (add/save/list of items done by service builder).
Now I need separate liferay page with only add new functionality - can this be done with one portlet or should I copy it to separate portlet?
What I think I need:
- way to open portlet with redirection to edit form (edit.jsp)
- way to redirect to other liferay page with param (itemId) that would open that page on details.jsp and not standard view.jsp.
==== EDIT:
Now I do have links like that:
details:
<liferay-portlet:renderURL varImpl="rowURL">
<portlet:param name="backURL" value="<%= portletURLString %>" />
<portlet:param name="mvcPath" value="/html/details.jsp" />
<portlet:param name="itemId" value="<%= String.valueOf(item.getId()) %>" />
</liferay-portlet:renderURL>
add:
<liferay-portlet:renderURL varImpl="addURL">
<portlet:param name="mvcPath" value="/html/edit.jsp" />
</liferay-portlet:renderURL>
But they only work in the same portlet/page.
In liferay I have two public pages: "search/details" and "add".
On the "add" page this portlet should render edit.jsp (second url). Then after an action I should redirect authorized user to "search/details" page with id of the newly created item and show its details.
I can create two portlets but I'm sure there is better and more liferayish solution to this problem.
target="_blank"
on the anchor(s), where you are usingrowURL
/addURL
to open that link on new tab. The rest will be handled by portlet lifecycle to render specific view based on theportlet:param
set for the URL. – Parkash Kumar