We've been running struts 2 apps as standalone and portlet using the same code/war file for a long time. We do use the portlet plugin and include 2 different struts.xml configurations using different namespaces. For example our struts.xml file includes each configuration using includes as follows:
struts.xml <struts> ... <!-- Include the various configurations --> <include file="struts-standalone.xml"/> <include file="struts-portlet.xml"/> struts-standalone.xml <struts> ... <!-- Configuration for the standalone package. --> <package name="default" extends="struts-default" namespace="/sa"> struts-portlet.xml (this one includes a reference to the portletDefaultStack inteceptor) <struts> ... <!-- Configuration for the portlet package. --> <package name="portlet-default" extends="struts-portlet-default" namespace="/portlet"> This all works fine and has a lot of advantages. The portlet plugin has never caused any issues with our standalone webapp either. If you need more information on how we do this, I'd be happy to share details. Todd Kofford Academic Services Development KU Information Technology tkoff...@ku.edu (785) 864-0327 ________________________________________ From: Lukasz Lenart [lukaszlen...@apache.org] Sent: Friday, February 21, 2014 1:53 AM To: Struts Developers List Subject: Re: Struts2 Portlet with Servlets As I understand at the same time you want to have the same web app exposed as portlet and as as a normal Struts2 app? It isn't possible to do in one Struts 2 app as attaching The Struts Portlet Plugin enables portlet integration for the whole app and some internals are changed (eg. how urls are rendered). You can use the same action in portlet and non-portlet app but not at the same time - you must remove portlet plugin to use it in non-portlet environment. 2014-02-20 20:24 GMT+01:00 Gaurav Daga <togauravd...@gmail.com>: > And I did follow the tutorial and that's how I got upto the speed with > Struts2. Also I didn't mention earlier, <s:url..> treats my Servlet Action > class as Portlet Action class and generates URL specific to it. > > I appreciate your help on this Lukasz. > > > *Thanks & Regards/ **सादर**,* > *Gaurav Daga* > *togauravd...@gmail.com <togauravd...@gmail.com> | +1.201.308.3242 | Web > Presence <http://goo.gl/lW0nh> * > Do not follow where the path may lead. Go instead where there is no path > and leave a trail. - Harold R. McAlindon > > > On Thu, Feb 20, 2014 at 11:20 AM, Gaurav Daga <togauravd...@gmail.com>wrote: > >> I used Struts2 filter, and here is web.xml for the same : >> <filter> >> <filter-name>struts2</filter-name> >> <filter-class> >> >> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter >> </filter-class> >> </filter> >> >> <filter-mapping> >> <filter-name>struts2</filter-name> >> <url-pattern>/servlet/*</url-pattern> >> </filter-mapping> >> >> >> *Thanks & Regards/ **सादर**,* >> *Gaurav Daga* >> *togauravd...@gmail.com <togauravd...@gmail.com> | +1.201.308.3242 >> <%2B1.201.308.3242> | Web Presence <http://goo.gl/lW0nh> * >> Do not follow where the path may lead. Go instead where there is no path >> and leave a trail. - Harold R. McAlindon >> >> >> On Thu, Feb 20, 2014 at 10:38 AM, Lukasz Lenart >> <lukaszlen...@apache.org>wrote: >> >>> You didn't provide your web.xml, have you tried follow the tutorial? >>> >>> http://struts.apache.org/release/2.3.x/docs/struts-2-portlet-tutorial.html >>> >>> >>> 2014-02-20 19:31 GMT+01:00 Gaurav Daga <togauravd...@gmail.com>: >>> > 1. CaseTaskPortlet is a portlets action class. >>> > 2. caseTasks is servlet based action class. >>> > >>> > Problem I am having is, if I use <s:url....> tag to generate endpoint >>> for >>> > my Servlet based action class, it doesn't work. And I tried accessing >>> it >>> > from browser by constructing a URL manually, it doesn't invoke my >>> action. >>> > >>> > Looking at the below configuration, if you can suggest me like what >>> should >>> > be my URL to hit the displaySomeMessage() method inside CaseTasksAction >>> > action class? >>> > >>> > >>> > Below here is struts xml, I am having: >>> > >>> > >>> > <?xml version="1.0" encoding="UTF-8" ?> >>> > <!DOCTYPE struts PUBLIC >>> > "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" >>> > "http://struts.apache.org/dtds/struts-2.3.dtd"> >>> > <struts> >>> > <constant name="struts.devMode" value="true" /> >>> > <package name="amps-base-package" extends="struts-portlet-default"> >>> > <interceptors> >>> > <interceptor name="EJBInjectionInterceptor" >>> > >>> class="gov.nv.dwss.amps.presentation.struts.interceptors.EJBInjectionInterceptor" >>> > /> >>> > <interceptor-stack name="baseStack"> >>> > <interceptor-ref name="defaultStack" /> >>> > <interceptor-ref name="EJBInjectionInterceptor" /> >>> > </interceptor-stack> >>> > </interceptors> >>> > <default-interceptor-ref name="baseStack" /> >>> > </package> >>> > <constant name="struts.custom.i18n.resources" >>> > >>> value="gov.nv.dwss.framework.resourebundle.DplyTxtResourceBundle,gov.nv.dwss.framework.resourebundle.ValidationMessageResourceBundle" >>> > /> >>> > >>> > <package name="view" extends="amps-base-package" >>> > namespace="/CaseTaskPortlet/view"> >>> > <action name="HomeCaseTaskAction.*" method="{1}" >>> > >>> class="gov.nv.dwss.amps.casetask.presentation.action.HomeCaseTaskAction"> >>> > <result name="home">/jsp/casetask/home.jsp</result> >>> > <result name="search">/jsp/casetask/search.jsp</result> >>> > <result name="expeditedSNAP">/jsp/casetask/expeditedSNAP.jsp</result> >>> > <result name="applications">/jsp/casetask/applications.jsp</result> >>> > <result name="changes">/jsp/casetask/changes.jsp</result> >>> > <result name="RDRCERTHOME">/jsp/casetask/rdrcert.jsp</result> >>> > <result name="mytasks">/jsp/casetask/mytasks.jsp</result> >>> > </action> >>> > </package> >>> > <package name="caseTasks" namespace="/caseTasks" >>> extends="struts-default"> >>> > <action name="CaseTasksAction" >>> > class="gov.nv.dwss.amps.casetask.presentation.action.CaseTasksAction"> >>> > <result name="servletHome">/jsp/casetask/test.jsp</result> >>> > </action> >>> > </package> >>> > </struts> >>> > >>> > >>> > *Thanks & Regards/ **सादर**,* >>> > *Gaurav Daga* >>> > *togauravd...@gmail.com <togauravd...@gmail.com> | +1.201.308.3242 | >>> Web >>> > Presence <http://goo.gl/lW0nh> * >>> > Do not follow where the path may lead. Go instead where there is no path >>> > and leave a trail. - Harold R. McAlindon >>> > >>> > >>> > On Wed, Feb 19, 2014 at 10:07 PM, Lukasz Lenart < >>> lukaszlen...@apache.org>wrote: >>> > >>> >> But in struts.xml you can define actions - no reference to servlets >>> >> neither portlets. Do you have any error message? >>> >> >>> >> 2014-02-20 2:41 GMT+01:00 Gaurav Daga <togauravd...@gmail.com>: >>> >> > Hello Struts2 Group, >>> >> > >>> >> > I have a requirement where I want to have Servlet Action Endpoint, as >>> >> well >>> >> > as Portlet Actions in the same WAR file. I tried configuring the >>> >> > struts.xml, for the both package but Struts continued to give me >>> error >>> >> > while resolving Servlet Action Endpoint. >>> >> > >>> >> > I just wanted to know if anyone has tries anything similar to this >>> before >>> >> > and whether it is supported or not. If you can throw me some >>> pointers, >>> >> > would be great help! >>> >> > >>> >> > >>> >> > Thanks. >>> >> > Gaurav Daga >>> >> >>> >> --------------------------------------------------------------------- >>> >> To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org >>> >> For additional commands, e-mail: dev-h...@struts.apache.org >>> >> >>> >> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org >>> For additional commands, e-mail: dev-h...@struts.apache.org >>> >>> >> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org For additional commands, e-mail: dev-h...@struts.apache.org