Today we will open Web Content Edit Page from our custom portlet.We already know how to write struts action hook here we use the same approach. We create a simple portlet and provide a link on click of that link we open the web content in control panel.
Just Use this code in your jsp:-
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@page import="java.util.Locale"%> | |
<%@page import="javax.portlet.WindowState"%> | |
<%@page import="com.liferay.portlet.journal.model.JournalArticle"%> | |
<%@page import="com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil"%> | |
<%@page import="com.liferay.portal.util.PortletKeys"%> | |
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %> | |
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> | |
<portlet:defineObjects /> | |
<% | |
JournalArticle article = JournalArticleLocalServiceUtil.getLatestArticle(11609); | |
%> | |
<liferay-portlet:renderURL windowState="<%= WindowState.MAXIMIZED.toString() %>" var="editURL" portletName="<%= PortletKeys.JOURNAL %>" doAsGroupId="<%=article.getGroupId()%>"> | |
<portlet:param name="struts_action" value="/journal/edit_article" /> | |
<portlet:param name="groupId" value="<%=String.valueOf(article.getGroupId())%>" /> | |
<portlet:param name="folderId" value="<%= String.valueOf(article.getFolderId()) %>" /> | |
<portlet:param name="articleId" value="<%=String.valueOf(article.getArticleId())%>" /> | |
<portlet:param name="version" value="<%=String.valueOf(article.getVersion())%>" /> | |
</liferay-portlet:renderURL> | |
Click Here to Edit Web Content:- | |
<a href="${editURL}"><%=article.getTitle(Locale.ENGLISH)%></a> |
Hope this will Help....
Related Post:-
Related Post:-
No comments:
Post a Comment