掲示板

Shall we add new jsps in hook

8年前 に Laxman Deepak によって更新されました。

Shall we add new jsps in hook

Junior Member 投稿: 48 参加年月日: 14/11/11 最新の投稿
Hello all,
My requirment is
1) I am trying to override the native liferay jsp i.e tollbar.jsp to add new button
2) When i click on this new button i should do navigation to the new jsp i.e usermigration.jsp
3) So to call usermigration.jsp(new) from tollbar.jsp(native),I wrote following render url
toolbar.jsp
<portlet:renderurl var="userMigrationRequest" portletmode="view">
	 <portlet:param name="mvcPath" value="/html/user_migration_request.jsp" />			 
</portlet:renderurl>

<span class="lfr-toolbar-button liferay_sync-button"><a href="<%= userMigrationRequest.toString() %>"><img alt="" src="http://localhost:8080/cpp-control-panel-theme/images/common/liferay_sync.png" class="icon" id="aui_3_4_0_1_635"><liferay-ui:message key="Migrate user" /></a></span>

4) I created usermigration.jsp(new) under html folder of hook(/html/user_migration_request.jsp)
5) Now the problem is when i am clicking on that button then it is not navigating to this new page and it is persisting in the same page.
Please can anyone give suggestions to implement.
thumbnail
8年前 に Tina Agrawal によって更新されました。

RE: Shall we add new jsps in hook

Expert 投稿: 297 参加年月日: 08/01/03 最新の投稿
You cant add JSPs like that.

All liferay portlets are by default struts portlets. You will need to define a new struts action.
You can follow this link for some ideas - https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/overriding-and-adding-struts-actions

Tina
8年前 に Laxman Deepak によって更新されました。

RE: Shall we add new jsps in hook

Junior Member 投稿: 48 参加年月日: 14/11/11 最新の投稿
Even if i add new jsp in the same hook also do we need struts action?
thumbnail
8年前 に David H Nebinger によって更新されました。

RE: Shall we add new jsps in hook

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
JSPs just handle the render, they don't deal with the action.

The struts action addition allows you to maintain the normal struts operation of the Liferay core portlets. So you add both the new JSP for the presentation and the new action handler for the activity.
8年前 に Laxman Deepak によって更新されました。

RE: Shall we add new jsps in hook

Junior Member 投稿: 48 参加年月日: 14/11/11 最新の投稿
I implemented the struts action as below steps
1) Created custom action class which it implements BaseStrutsAction
2) Add an entry in liferay-hook.xml
<struts-action>
		<struts-action-path>/users_admin/remigrate_user</struts-action-path>
		<struts-action-impl>com.hp.cpp.usersadmin.action.MigrationUserAction</struts-action-impl>
	</struts-action> 

3) Calling that struts action in the jsp as follows
<portlet:actionurl var="userMigrationURL">
			<portlet:param name="struts_action" value="/users_admin/remigrate_user" />
			<portlet:param name="CMD" value="MIGRATE" />
			<portlet:param name="redirect" value="/html/user_migration_request.jsp" /> 
	</portlet:actionurl>

<a href="<%=userMigrationURL%>"><img alt="" src="http://localhost:8080/cpp-control-panel-theme/images/common/liferay_sync.png"></a>

4) when i was clicking this hyper link i am getting the following Exception
15:41:46,294 INFO  [stdout] (http--127.0.0.1-8080-2) 15:41:46,292 WARN  [http--127.0.0.1-8080-2][PortletRequestProcessor:160] This URL can only be invoked using POST: /group/control_panel/manage?p_auth=gRyz3gEz&amp;p_p_id=125&amp;p_p_lifecycle=1&amp;p_p_state=maximized&amp;p_p_mode=view&amp;doAsGroupId=381208&amp;refererPlid=199942&amp;_125_struts_action=%2Fusers_admin%2Fremigrate_user&amp;_125_CMD=MIGRATE&amp;_125_redirect=%2Fhtml%
2Fuser_migration_request.jsp
15:41:46,464 INFO  [stdout] (com.liferay.portal.plugin.PluginPackageUtil) 15:41:46,464 WARN  [com.liferay.portal.plugin.PluginPackageUtil][PluginPackageUtil:1429] Unable to communicate with repository http://plugins.liferay.com/enterprise
15:41:46,822 WARN  [org.apache.struts.action.RequestProcessor] (http--127.0.0.1-8080-2) Unhandled Exception thrown: class com.liferay.portal.security.auth.PrincipalException
15:41:46,836 INFO  [stdout] (http--127.0.0.1-8080-2) 15:41:46,829 ERROR [http--127.0.0.1-8080-2][render_portlet_jsp:170]
15:41:46,837 INFO  [stdout] (http--127.0.0.1-8080-2) com.liferay.portal.security.auth.PrincipalException: /group/control_panel/manage?p_auth=gRyz3gEz&amp;p_p_id=125&amp;p_p_lifecycle=1&amp;p_p_state=maximized&amp;p_p_mode=view&amp;doAsGroupId=381208&amp;refererPlid=199942&amp;_125_struts_action=%2Fusers_admin%2Fremigrate_user&amp;_125_CMD=MIGRATE&amp;_125_redirect=%2Fhtml%2Fuser_migration_request.jsp
15:41:46,841 INFO  [stdout] (http--127.0.0.1-8080-2)    at com.liferay.portal.struts.PortletRequestProcessor.process(PortletRequestProcessor.java:165)
15:41:46,845 INFO  [stdout] (http--127.0.0.1-8080-2)    at com.liferay.portlet.StrutsPortlet.processAction(StrutsPortlet.java:214)
15:41:46,847 INFO  [stdout] (http--127.0.0.1-8080-2)    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:71)
15:41:46,849 INFO  [stdout] (http--127.0.0.1-8080-2)    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
15:41:46,855 INFO  [stdout] (http--127.0.0.1-8080-2)    at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:616)
15:41:46,856 INFO  [stdout] (http--127.0.0.1-8080-2)    at com.liferay.portlet.InvokerPortletImpl.invokeAction(InvokerPortletImpl.java:647)
15:41:46,859 INFO  [stdout] (http--127.0.0.1-8080-2)    at com.liferay.portlet.InvokerPortletImpl.processAction(InvokerPortletImpl.java:315)
15:41:46,860 INFO  [stdout] (http--127.0.0.1-8080-2)    at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:963)
15:41:46,863 INFO  [stdout] (http--127.0.0.1-8080-2)    at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:701)
15:41:46,865 INFO  [stdout] (http--127.0.0.1-8080-2)    at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:262)
15:41:46,866 INFO  [stdout] (http--127.0.0.1-8080-2)    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
15:41:46,867 INFO  [stdout] (http--127.0.0.1-8080-2)    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
15:41:46,868 INFO  [stdout] (http--127.0.0.1-8080-2)    at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:182)

Please suggest me to get rid of this.
thumbnail
8年前 に David H Nebinger によって更新されました。

RE: Shall we add new jsps in hook

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Looks like you're trying to redirect to the control panel, of which you don't have access (hence the principle exception).