Hi Mukund,
Please find attached sample struts portlet . and follow steps to create Struts Portlet in Liferay 6.x
Liferay 6 HelloWorld Struts Portlet
1.1. liferay-portlet.xml
Update the below content
<portlet>
<portlet-name>emptoris-search</portlet-name>
<portlet-url-class>com.liferay.portal.apache.bridges.struts.LiferayStrutsPortletURLImpl</portlet-url-class>
<use-default-template>true</use-default-template>
</portlet>
2. portlet.xml
Update portlet-class and init-param
<portlet-class>org.apache.portals.bridges.struts.StrutsPortlet</portlet-class>
<init-param>
<name>ServletContextProvider</name>
<value>com.liferay.util.bridges.struts.LiferayServletContextProviderWrapper</value>
</init-param>
<init-param>
<name>ViewPage</name>
<value>/portlet_action/search/view</value>
</init-param>
<portlet>
<portlet-name>emptoris-search</portlet-name>
<display-name>Emptoris-Search</display-name>
<portlet-class>org.apache.portals.bridges.struts.StrutsPortlet</portlet-class>
<init-param>
<name>ServletContextProvider</name>
<value>com.liferay.util.bridges.struts.LiferayServletContextProviderWrapper</value>
</init-param>
<init-param>
<name>ViewPage</name>
<value>/portlet_action/search/view</value>
</init-param>
3.web.xml
insert struts servlet class
<servlet>
<servlet-name>PortletActionServlet</servlet-name>
<servlet-class>com.liferay.util.bridges.struts.LiferayPortletServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>PortletActionServlet</servlet-name>
<url-pattern>/portlet_action/*</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>http://struts.apache.org/tags-bean</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://portals.apache.org/bridges/struts/tags-portlet-html</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-portlet-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://struts.apache.org/tags-logic</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://struts.apache.org/tags-nested</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://struts.apache.org/tags-tiles</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
</taglib>
4.struts-config.xml
<action path="/search/view" type="com.cignex.sample.struts.StrutsHelloWorldAction" scope="request" validate="false">
<forward name="view_result" path="portlet.sample.view"></forward>
</action>
5.tiles-defs.xml
<definition name="portlet.sample.view" extends="portlet.search">
<put name="portlet_content" value="/portlet/sample/viewResult.jsp" />
</definition>
6.StrutsHelloWorldAction.java
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
// TODO Auto-generated method stub
return mapping.findForward("view_result");
}
Best Regards,
Muthukumar Thangavinayagam
Please sign in to flag this as inappropriate.