You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by john lee <sh...@yahoo.com> on 2013/05/09 20:33:22 UTC

struts 2 / sitemesh/
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat partsearchinput.jsp

<%@ taglib prefix="s" uri="/struts-tags"%>

<s:actionerror/>
<s:form action="partsearchinput">
<s:textfield name="partid" label="partid"/>
<s:submit value="search"/>
</s:form>

the above code works, and verified by http://localhost/ecommerce/partsearchinput.jsp

but, after i start to use sitemesh, it has the problem as the following

The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]

SEVERE: Unhandled exception occurred whilst decorating page
java.lang.RuntimeException: org.apache.jasper.JasperException: An exception occurred processing JSP page /partsearchinput.jsp at line 6
3:
4: <%@ taglib prefix="s" uri="/struts-tags"%>
5:
6: <s:actionerror/>
7: <s:form action="partsearchinput">
8: <s:textfield name="partid" label="partid"/>
9: <s:submit value="search"/>


****************************************************************************
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat web.xml

<filter>
<filter-name>struts2</filter-name>
  <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter>   
   <filter-name>sitemesh</filter-name> 
      <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter
   </filter-class> 
</filter> 
<filter-mapping> 
    <filter-name>sitemesh</filter-name> 
     <url-pattern>/*</url-pattern>
     <dispatcher>FORWARD</dispatcher>   
         <dispatcher>REQUEST</dispatcher> 
</filter-mapping>
**********************************************************************
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/decorators # cat basic-theme.jsp

 <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
 
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator"%>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/page" prefix="page"%>

<%@ taglib prefix="s" uri="/struts-tags"%>
     
    <body>
         <table width="100%" height="100%">
               <tr> <td> 
                 <%@ include file="/partsearchinput.jsp"%>
               </td></tr>
               <tr> <td> 
                   <decorator:body />    <hr />
               </td></tr>
               <tr> <td> <h2> <p><font color=blue>Copyright XXXXX</font></p>  </h2> </td></tr>
         </table>
    </body>
  *******************************************************************************
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat decorators.xml
<decorators defaultdir="/decorators"> 
   
   <decorator name="basic-theme" page="basic-theme.jsp"> 
       <pattern>/menu.jsp</pattern> 
   </decorator>
  </decorators>
**********************************************************************************
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat partsearchinput.jsp

<%@ taglib prefix="s" uri="/struts-tags"%>
<s:actionerror/>
<s:form action="partsearchinput">
<s:textfield name="partid" label="partid"/>
<s:submit value="search"/>
</s:form>
***********************************************************************************
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat menu.jsp

    <body>   
         <h1>test</p>
   </body>

Re: struts 2 / sitemesh/ Posted by Lukasz Lenart <lu...@apache.org>.
Ken you are right, there are few options how to integrate Sitemesh
with Struts2 and all are documented on the page

http://struts.apache.org/development/2.x/docs/sitemesh-plugin.html


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/


2013/5/9 Ken McWilliams <ke...@gmail.com>:
> I know very little about sitemesh integration and am away from my
> development machine but I think the integration guides mention you need to
> use the StrutsPrepareFilter followed by the
> SiteMeshFilter filter followed by the StrutsExecute filter.
>
> Guessing but the SiteMeshFilter might be a custom one designed for struts2
> integration (if there is a struts2-sitemesh-plugin) I'd verify if this is
> the case.
>
>
> On Thu, May 9, 2013 at 12:33 PM, john lee <sh...@yahoo.com> wrote:
>
>>
>>
>> alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat partsearchinput.jsp
>>
>> <%@ taglib prefix="s" uri="/struts-tags"%>
>>
>> <s:actionerror/>
>> <s:form action="partsearchinput">
>> <s:textfield name="partid" label="partid"/>
>> <s:submit value="search"/>
>> </s:form>
>>
>> the above code works, and verified by
>> http://localhost/ecommerce/partsearchinput.jsp
>>
>> but, after i start to use sitemesh, it has the problem as the following
>>
>> The Struts dispatcher cannot be found.  This is usually caused by using
>> Struts tags without the associated filter. Struts tags are only usable when
>> the request has passed through its servlet filter, which initializes the
>> Struts dispatcher needed for this tag. - [unknown location]
>>
>> SEVERE: Unhandled exception occurred whilst decorating page
>> java.lang.RuntimeException: org.apache.jasper.JasperException: An
>> exception occurred processing JSP page /partsearchinput.jsp at line 6
>> 3:
>> 4: <%@ taglib prefix="s" uri="/struts-tags"%>
>> 5:
>> 6: <s:actionerror/>
>> 7: <s:form action="partsearchinput">
>> 8: <s:textfield name="partid" label="partid"/>
>> 9: <s:submit value="search"/>
>>
>>
>>
>> ****************************************************************************
>> alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat web.xml
>>
>> <filter>
>> <filter-name>struts2</filter-name>
>>
>> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
>> </filter>
>> <filter>
>>    <filter-name>sitemesh</filter-name>
>>       <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter
>>    </filter-class>
>> </filter>
>> <filter-mapping>
>>     <filter-name>sitemesh</filter-name>
>>      <url-pattern>/*</url-pattern>
>>      <dispatcher>FORWARD</dispatcher>
>>          <dispatcher>REQUEST</dispatcher>
>> </filter-mapping>
>> **********************************************************************
>> alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/decorators # cat
>> basic-theme.jsp
>>
>>  <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator"
>> prefix="decorator" %>
>>
>> <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator"
>> prefix="decorator"%>
>> <%@ taglib uri="http://www.opensymphony.com/sitemesh/page" prefix="page"%>
>>
>> <%@ taglib prefix="s" uri="/struts-tags"%>
>>
>>     <body>
>>          <table width="100%" height="100%">
>>                <tr> <td>
>>                  <%@ include file="/partsearchinput.jsp"%>
>>                </td></tr>
>>                <tr> <td>
>>                    <decorator:body />    <hr />
>>                </td></tr>
>>                <tr> <td> <h2> <p><font color=blue>Copyright
>> XXXXX</font></p>  </h2> </td></tr>
>>          </table>
>>     </body>
>>
>> *******************************************************************************
>> alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat
>> decorators.xml
>> <decorators defaultdir="/decorators">
>>
>>    <decorator name="basic-theme" page="basic-theme.jsp">
>>        <pattern>/menu.jsp</pattern>
>>    </decorator>
>>   </decorators>
>>
>> **********************************************************************************
>> alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat partsearchinput.jsp
>>
>> <%@ taglib prefix="s" uri="/struts-tags"%>
>> <s:actionerror/>
>> <s:form action="partsearchinput">
>> <s:textfield name="partid" label="partid"/>
>> <s:submit value="search"/>
>> </s:form>
>>
>> ***********************************************************************************
>> alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat menu.jsp
>>
>>     <body>
>>          <h1>test</p>
>>    </body>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts 2 / sitemesh/ Posted by Ken McWilliams <ke...@gmail.com>.
I know very little about sitemesh integration and am away from my
development machine but I think the integration guides mention you need to
use the StrutsPrepareFilter followed by the
SiteMeshFilter filter followed by the StrutsExecute filter.

Guessing but the SiteMeshFilter might be a custom one designed for struts2
integration (if there is a struts2-sitemesh-plugin) I'd verify if this is
the case.


On Thu, May 9, 2013 at 12:33 PM, john lee <sh...@yahoo.com> wrote:

>
>
> alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat partsearchinput.jsp
>
> <%@ taglib prefix="s" uri="/struts-tags"%>
>
> <s:actionerror/>
> <s:form action="partsearchinput">
> <s:textfield name="partid" label="partid"/>
> <s:submit value="search"/>
> </s:form>
>
> the above code works, and verified by
> http://localhost/ecommerce/partsearchinput.jsp
>
> but, after i start to use sitemesh, it has the problem as the following
>
> The Struts dispatcher cannot be found.  This is usually caused by using
> Struts tags without the associated filter. Struts tags are only usable when
> the request has passed through its servlet filter, which initializes the
> Struts dispatcher needed for this tag. - [unknown location]
>
> SEVERE: Unhandled exception occurred whilst decorating page
> java.lang.RuntimeException: org.apache.jasper.JasperException: An
> exception occurred processing JSP page /partsearchinput.jsp at line 6
> 3:
> 4: <%@ taglib prefix="s" uri="/struts-tags"%>
> 5:
> 6: <s:actionerror/>
> 7: <s:form action="partsearchinput">
> 8: <s:textfield name="partid" label="partid"/>
> 9: <s:submit value="search"/>
>
>
>
> ****************************************************************************
> alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat web.xml
>
> <filter>
> <filter-name>struts2</filter-name>
>
> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
> </filter>
> <filter>
>    <filter-name>sitemesh</filter-name>
>       <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter
>    </filter-class>
> </filter>
> <filter-mapping>
>     <filter-name>sitemesh</filter-name>
>      <url-pattern>/*</url-pattern>
>      <dispatcher>FORWARD</dispatcher>
>          <dispatcher>REQUEST</dispatcher>
> </filter-mapping>
> **********************************************************************
> alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/decorators # cat
> basic-theme.jsp
>
>  <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator"
> prefix="decorator" %>
>
> <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator"
> prefix="decorator"%>
> <%@ taglib uri="http://www.opensymphony.com/sitemesh/page" prefix="page"%>
>
> <%@ taglib prefix="s" uri="/struts-tags"%>
>
>     <body>
>          <table width="100%" height="100%">
>                <tr> <td>
>                  <%@ include file="/partsearchinput.jsp"%>
>                </td></tr>
>                <tr> <td>
>                    <decorator:body />    <hr />
>                </td></tr>
>                <tr> <td> <h2> <p><font color=blue>Copyright
> XXXXX</font></p>  </h2> </td></tr>
>          </table>
>     </body>
>
> *******************************************************************************
> alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat
> decorators.xml
> <decorators defaultdir="/decorators">
>
>    <decorator name="basic-theme" page="basic-theme.jsp">
>        <pattern>/menu.jsp</pattern>
>    </decorator>
>   </decorators>
>
> **********************************************************************************
> alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat partsearchinput.jsp
>
> <%@ taglib prefix="s" uri="/struts-tags"%>
> <s:actionerror/>
> <s:form action="partsearchinput">
> <s:textfield name="partid" label="partid"/>
> <s:submit value="search"/>
> </s:form>
>
> ***********************************************************************************
> alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat menu.jsp
>
>     <body>
>          <h1>test</p>
>    </body>