I have a large existing application that uses a common page layout and would
like to use struts tiles.  I do not want to use struts actions and such
because there is already a controller in the application, we would like to
just use the Tiles template mechanism.

>From what I've read it seems that we should be able to have the current
forwards, which are mapped in web.xml using url-mappings.  The current pages
were mapped using the extension view.  I am using the latest struts binary
build and tomcat 4.0.  Documentation alludes that you can map urls onto
tiles-defs with the latest release.  At the bottom is the request url I
tried and there was no output given in the console, just and error in the
browser "The specified HTTP method is not allowed for the requested resource
(HTTP method GET is not supported by this URL)."  Hopefully someone with
more experience in Tiles could point me in the right direction; all I want
is to move our current "view" url mappings from web.xml into
tiles-definitions.xml and have tiles assemble the pages using a standard
presentation layout.  Thank you for any help you provide.


<!-- web.xml -->
  <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.tiles.TilesServlet</servlet-class> 
    <init-param>
      <param-name>definitions-config</param-name>
      <param-value>/WEB-INF/tiles-definitions.xml</param-value>
    </init-param>       
    <init-param>
      <param-name>definitions-debug</param-name>
      <param-value>2</param-value>
    </init-param>       
    <init-param>
      <param-name>definitions-parser-details</param-name>
      <param-value>2</param-value>
    </init-param>       
    <init-param>
      <param-name>definitions-parser-validate</param-name>
      <param-value>true</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>validate</param-name>
      <param-value>true</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>       
    <load-on-startup>2</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.view</url-pattern>
  </servlet-mapping>
  
<!-- struts-config.xml -->
  <struts-config>
    <plug-in className="org.apache.struts.tiles.TilesPlugin" >
      <set-property property="definitions-config"
value="/WEB-INF/tiles-definitions.xml" />
      <set-property property="definitions-debug"  value="2" />
      <set-property property="definitions-parser-details"  value="2" />
      <set-property property="definitions-parser-validate" value="true" />
    </plug-in>  
  </struts-config>

<!-- tiles-definitions.xml -->
  <tiles-definitions>
    <definition name="mainLayout" path="/layout.jsp" >
        <put name="title" value="Login" />
        <put name="body"  value="/Login.jsp" />
    </definition>
    <definition name="Login" extends="mainLayout" >
        <put name="title" value="Login" />
        <put name="body"  value="/Login.jsp" />
    </definition>
    <definition name="LoginConfirm" extends="mainLayout" >
        <put name="title" value="Main" />
        <put name="body"  value="/LoginConfirm.jsp" />
    </definition>
  </tiles-definitions>


<!-- output from tomcat upon requesting http://localhost/app/Login.view -->
Start Tiles initialization
Try to load Tiles factory
factory loaded : {Login={name=Login, path=/layout.jsp, role=null,
controller=null, controllerType=null, controllerInstance=null,
attributes={title=Login, body=/Login.jsp}}
, LoginConfirm={name=LoginConfirm, path=/layout.jsp, role=null,
controller=null, controllerType=null, controllerInstance=null,
attributes={title=Main, body=/LoginConfirm.jsp}}
, mainLayout={name=mainLayout, path=/layout.jsp, role=null, controller=null,
controllerType=null, controllerInstance=null, attributes={title=Login,
body=/Login.jsp}}
}
Factory initialized from file '/WEB-INF/tiles-definitions.xml'.
Starting service Tomcat-Apache
Apache Tomcat/4.0.4

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to