You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "S.Bharathi" <bh...@yahoo.co.in> on 2002/10/03 11:00:59 UTC

Newbie: problem with tiles definitions

Hi all,
    I just started working with tiles and struts. I have the following files xmls in the web-inf directory. I am working with the example given in the site 
http://www.javaworld.com/javaworld/jw-01-2002/jw-0104-tilestrut.html 
    
    When I try to access the jsp files, there seems to be no problem. When I access a.do, I get the following error with tomcat ( 4.0.1 )

type : Status report

message  : Servlet action is currently unavailable

description : The requested service (Servlet action is currently unavailable) is not currently available.

Thanks in advance.

-Bharathi


=======================
File : struts-config.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" 
                 value="/WEB-INF/tileDefinitions.xml  />
<set-property property="definitions-debug" value="0" />
<set-property property="definitions-parser-details" value="0" />
<set-property property="definitions-parser-validate" value="true" />
</plug-in>

<action-mappings>
    <action path="/a" type="DoFirst">
       <forward name="success" path="aDef"/>
    </action>
    <action path="/b" type="DoFirst">
     <forward name="success" path="bDef"/>
    </action>
    <action path="/c" type="DoFirst">
     <forward name="success" path="cDef"/>
    </action>
  </action-mappings>
</struts-config>

================================================

File web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class> org.apache.struts.tiles.ActionComponentServlet
</servlet-class>
<init-param>
  <param-name>definitions-config</param-name>
  <param-value>/WEB-INF/tileDefinitions.xml</param-value>
</init-param>
        
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<init-param>
  <param-name>config</param-name>
  <param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
  <param-name>debug</param-name>
  <param-value>2</param-value>
</init-param>
<init-param>
  <param-name>detail</param-name>
  <param-value>2</param-value>
</init-param>
<init-param>
  <param-name>validate</param-name>
  <param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>

<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<!-- The Welcome File List -->

<!-- Struts Tag Library Descriptor -->
<taglib>
<taglib-uri> /WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location> /WEB-INF/struts-bean.tld </taglib-location>
</taglib>
<taglib>
  <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
  <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
</web-app>

=======================

File : tileDefinitions.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<component-definitions>
    <definition name="aDef" path="/layout.jsp">
        <put name="header" value="/header.jsp"/>
        <put name="footer" value="/footer.jsp"/>
        <put name="body" value="/aBody.jsp"/>
    </definition>
    <definition name="bDef" path="/layout.jsp">
        <put name="header" value="/header.jsp"/>
        <put name="footer" value="/footer.jsp"/>
        <put name="body" value="/bBody.jsp"/>
    </definition>
    <definition name="cDef" path="/layout.jsp">
        <put name="header" value="/header.jsp"/>
        <put name="footer" value="/footer.jsp"/>
        <put name="body" value="/cBody.jsp"/>
    </definition>
</component-definitions>


Regards,
Bharathi
========
A Block of granite on the pathway is 
an obstacle for the weak but a 
stepping stone for the strong
====================================================


---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!

Re: Newbie: problem with tiles definitions

Posted by Cedric Dumoulin <ce...@apache.org>.
  Hello,

  Does your action exist ? Try to access the action directly from the 
browser, does it works ?

   Cedric

S.Bharathi wrote:

>Hi all,
>    I just started working with tiles and struts. I have the following files xmls in the web-inf directory. I am working with the example given in the site 
>http://www.javaworld.com/javaworld/jw-01-2002/jw-0104-tilestrut.html 
>    
>    When I try to access the jsp files, there seems to be no problem. When I access a.do, I get the following error with tomcat ( 4.0.1 )
>
>type : Status report
>
>message  : Servlet action is currently unavailable
>
>description : The requested service (Servlet action is currently unavailable) is not currently available.
>
>Thanks in advance.
>
>-Bharathi
>
>
>=======================
>File : struts-config.xml
>
><?xml version="1.0" encoding="ISO-8859-1" ?>
><!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
>
><struts-config>
><plug-in className="org.apache.struts.tiles.TilesPlugin" >
><set-property property="definitions-config" 
>                 value="/WEB-INF/tileDefinitions.xml  />
><set-property property="definitions-debug" value="0" />
><set-property property="definitions-parser-details" value="0" />
><set-property property="definitions-parser-validate" value="true" />
></plug-in>
>
><action-mappings>
>    <action path="/a" type="DoFirst">
>       <forward name="success" path="aDef"/>
>    </action>
>    <action path="/b" type="DoFirst">
>     <forward name="success" path="bDef"/>
>    </action>
>    <action path="/c" type="DoFirst">
>     <forward name="success" path="cDef"/>
>    </action>
>  </action-mappings>
></struts-config>
>
>================================================
>
>File web.xml
>
><?xml version="1.0" encoding="ISO-8859-1"?>
>
><!DOCTYPE web-app
>PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
>"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
>
><web-app>
><servlet>
><servlet-name>action</servlet-name>
><servlet-class> org.apache.struts.tiles.ActionComponentServlet
></servlet-class>
><init-param>
>  <param-name>definitions-config</param-name>
>  <param-value>/WEB-INF/tileDefinitions.xml</param-value>
></init-param>
>        
><init-param>
><param-name>application</param-name>
><param-value>ApplicationResources</param-value>
></init-param>
><init-param>
>  <param-name>config</param-name>
>  <param-value>/WEB-INF/struts-config.xml</param-value>
></init-param>
><init-param>
>  <param-name>debug</param-name>
>  <param-value>2</param-value>
></init-param>
><init-param>
>  <param-name>detail</param-name>
>  <param-value>2</param-value>
></init-param>
><init-param>
>  <param-name>validate</param-name>
>  <param-value>true</param-value>
></init-param>
><load-on-startup>2</load-on-startup>
></servlet>
>
><!-- Standard Action Servlet Mapping -->
><servlet-mapping>
><servlet-name>action</servlet-name>
><url-pattern>*.do</url-pattern>
></servlet-mapping>
>
><!-- The Welcome File List -->
>
><!-- Struts Tag Library Descriptor -->
><taglib>
><taglib-uri> /WEB-INF/struts-bean.tld</taglib-uri>
><taglib-location> /WEB-INF/struts-bean.tld </taglib-location>
></taglib>
><taglib>
>  <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
>  <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
></taglib>
></web-app>
>
>=======================
>
>File : tileDefinitions.xml
>
><?xml version="1.0" encoding="ISO-8859-1"?>
><component-definitions>
>    <definition name="aDef" path="/layout.jsp">
>        <put name="header" value="/header.jsp"/>
>        <put name="footer" value="/footer.jsp"/>
>        <put name="body" value="/aBody.jsp"/>
>    </definition>
>    <definition name="bDef" path="/layout.jsp">
>        <put name="header" value="/header.jsp"/>
>        <put name="footer" value="/footer.jsp"/>
>        <put name="body" value="/bBody.jsp"/>
>    </definition>
>    <definition name="cDef" path="/layout.jsp">
>        <put name="header" value="/header.jsp"/>
>        <put name="footer" value="/footer.jsp"/>
>        <put name="body" value="/cBody.jsp"/>
>    </definition>
></component-definitions>
>
>
>Regards,
>Bharathi
>========
>A Block of granite on the pathway is 
>an obstacle for the weak but a 
>stepping stone for the strong
>====================================================
>
>
>---------------------------------
>Do you Yahoo!?
>New DSL Internet Access from SBC & Yahoo!
>  
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>