You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andy T <ve...@gmail.com> on 2010/11/05 19:03:59 UTC

Struts Tiles Problem

Hi All,

I'm having a bit of trouble trying to get my tiles to work with Struts
and wondered if anyone could help.

The relevant files are shown below:

**** Web.xml ****

[code]
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>MiniHR</display-name>
	<servlet>
		<servlet-name>action</servlet-name>
		<servlet-class>
		org.apache.struts.action.ActionServlet</servlet-class>
		<init-param>
			<param-name>config</param-name>
			<param-value>/WEB-INF/struts-config.xml</param-value>
		</init-param>
		<init-param>
    		<param-name>chainConfig</param-name>
    		<param-value>org/apache/struts/tiles/chain-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>	
		
	
	<servlet>
    <servlet-name>tiles</servlet-name>
    <servlet-class>org.apache.tiles.web.startup.TilesServlet</servlet-class>
    <init-param>
        <param-name>
          org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
        </param-name>
        <param-value>
          /WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml
        </param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>



	</servlet>
	
	
		


	<servlet-mapping>
		<servlet-name>action</servlet-name>
		<url-pattern>*.do</url-pattern>
	</servlet-mapping>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>
	
</web-app>
[/code]


**** tiles-defs.xml ****

[code]
<?xml version="1.0"?>

<!DOCTYPE tiles-definitions PUBLIC
  "-//Apache Software Foundation//DTD Tiles Configuration 1.3//EN"
  "http://struts.apache.org/dtds/tiles-config_1_3.dtd">

<tiles-definitions>

<definition name="Home" template="/template.jsp">
		<put name="title" value="" />
		<put name="header" value="/header.jsp" />
	    <put name="menu" value="/menu.jsp" />
	    <put name="leftnav" value="/leftnav.jsp" />
		<put name="body" value="" />	
		<put name="footer" value="/footer.jsp" />
</definition>
	
	
<definition name="AddEnhancement" extends="Home">
	    <put name="title" value="Tiles tutorial homepage" />
	    <put name="body" value="/addenhancement.jsp" />
</definition>


</tiles-definitions>
[/code]


**** struts-config.xml ****

[code]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD
Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
	
	<form-beans>

                      (Form Beans Here)
		
	</form-beans>
	
	<global-exceptions>
	
	</global-exceptions>
	
	<global-forwards>
		<forward name="login" path="/login.jsp"/>
	</global-forwards>
	
	<action-mappings>
	

      <action path="/initializeaddenhancement"
      		parameter="method"
            type="EricEnhancement.struts.EnhancementAction"
            cancellable="true"
            validate="false">
            <forward name="success" path="AddEnhancement"/>
            <forward name="failure" path="/submitpage.jsp"/>
      </action>


      <action path="/Login"
      		input="/login.jsp"
            type="EricEnhancement.struts.LoginAction"
            name = "LoginForm"
            cancellable="true"
            validate="true">
            <forward name="success" path="Home"/>
            <forward name="failure" path="/login.jsp"/>
      </action>


	</action-mappings>
	
	<controller>
		<set-property  property="processorClass"
value="gov.ohio.odjfs.EricEnhancement.util.CustomRequestProcessor"/>
	</controller>
		
	<message-resources
parameter="ericenhancements.resources.MessageResources"></message-resources>
		
	<plug-in className="net.sf.navigator.menu.MenuPlugIn">
  		<set-property property="menuConfig" value="/WEB-INF/menu-config.xml"/>
	</plug-in>
	
	<!-- Validator Configuration -->
	<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
  		<set-property property="pathnames"
value="/org/apache/struts/validator/validator-rules.xml,
/WEB-INF/validation.xml"/>
	</plug-in>
	
	
	
</struts-config>
[/code]



I'm using struts-tiles-1.3.8.jar and when I run the above I get:
"java.lang.IllegalArgumentException: Path Home does not start with a
"/" character"

Can anyone help me with this?

Thanks,

Rob

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


Re: Struts Tiles Problem

Posted by Paul Benedict <pb...@apache.org>.
I don't know if this is your problem, per se, but you can't redirect
to a tile. A Tile is just an alias/synonym for a jsp rendering. You
can only forward to one.

Paul

On Mon, Nov 8, 2010 at 8:58 AM, Andy T <ve...@gmail.com> wrote:
> Thanks to all who have responded thus far . . .
>
> I think I forgot to add the Tiles Plugin to my struts-config.xml file.
>  However when I do this I get  "HTTP Status 404 - Servlet action is
> not available" . . .
>
>
>
>
>
>
>
> On Sat, Nov 6, 2010 at 2:47 AM, Lukasz Lenart
> <lu...@googlemail.com> wrote:
>> 2010/11/5 Rafael Medeiros <me...@gmail.com>:
>>> How to use plugin-tiles in struts 1.3.8:
>>
>> Check the documentation
>> http://struts.apache.org/1.x/struts-tiles/installation.html
>>
>>
>> Regards
>> --
>> Łukasz
>> + 48 606 323 122 http://www.lenart.org.pl/
>> Kapituła Javarsovia 2010 http://javarsovia.pl
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Struts Tiles Problem

Posted by Dave Newton <da...@gmail.com>.
Subclass the TilesRequestProcessor instead of the normal one.

Dave

On Mon, Nov 8, 2010 at 1:08 PM, Andy T <ve...@gmail.com> wrote:
> Hi Lukasz,
>
> Your identification of the exact cause of the error has helped me to
> solve this problem.  The problem is here:
>
> <controller>
>    <set-property  property="processorClass"
> value="EricEnhancement.util.CustomRequestProcessor"/>
> </controller>
>
> For whatever reason the CustomRequestProcessor I was using is not
> compatible with the TilesRequestProcessor.  When I remove the above
> from struts-config.xml everything SEEMS to work as expected.  I need
> to do a little more work to prove this definitively however.  However,
> this creates another issue.  I was using the CustomRequestProcessor to
> redirect to the login page under certain circumstances.  Can you
> recommend another approach that will accomplish the same thing?
>
> Thanks so much for your help,
>
> Andy
>
>
>
> On Mon, Nov 8, 2010 at 10:56 AM, Lukasz Lenart
> <lu...@googlemail.com> wrote:
>> 2010/11/8 Andy T <ve...@gmail.com>:
>>> Hi Lukasz,
>>>
>>> I have struts-tiles-1.3.8.jar loaded . . . is this what you mean?
>>
>> Yes, it should be sufficient, could you post your struts config? Below
>> is extract from the log you sent me.
>>
>> FATAL main org.apache.struts.tiles.TilesPlugin - TilesPlugin :
>> Specified RequestProcessor not compatible with TilesRequestProcessor
>> ERROR main org.apache.struts.action.ActionServlet - Unable to
>> initialize Struts ActionServlet due to an unexpected exception or
>> error thrown, so marking the servlet as unavailable.  Most likely,
>> this is due to an incorrect or missing library dependency.
>> javax.servlet.ServletException: TilesPlugin : Specified
>> RequestProcessor not compatible with TilesRequestProcessor
>>        at org.apache.struts.tiles.TilesPlugin.initRequestProcessorClass(TilesPlugin.java:382)
>>        at org.apache.struts.tiles.TilesPlugin.init(TilesPlugin.java:137)
>>        at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:871)
>>        at org.apache.struts.action.ActionServlet.init(ActionServlet.java:359)
>>        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
>>        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
>>        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
>>        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
>>        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
>>        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
>>        at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
>>        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
>>        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>>        at org.apache.catalina.core.StandardService.start(StandardService.java:448)
>>        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
>>        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
>>        at java.lang.reflect.Method.invoke(Method.java:599)
>>        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
>>        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
>>
>>
>>
>> Regards
>> --
>> Łukasz
>> + 48 606 323 122 http://www.lenart.org.pl/
>> Kapituła Javarsovia 2010 http://javarsovia.pl
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Struts Tiles Problem

Posted by Andy T <ve...@gmail.com>.
Hi Lukasz,

Your identification of the exact cause of the error has helped me to
solve this problem.  The problem is here:

<controller>
    <set-property  property="processorClass"
value="EricEnhancement.util.CustomRequestProcessor"/>
</controller>

For whatever reason the CustomRequestProcessor I was using is not
compatible with the TilesRequestProcessor.  When I remove the above
from struts-config.xml everything SEEMS to work as expected.  I need
to do a little more work to prove this definitively however.  However,
this creates another issue.  I was using the CustomRequestProcessor to
redirect to the login page under certain circumstances.  Can you
recommend another approach that will accomplish the same thing?

Thanks so much for your help,

Andy



On Mon, Nov 8, 2010 at 10:56 AM, Lukasz Lenart
<lu...@googlemail.com> wrote:
> 2010/11/8 Andy T <ve...@gmail.com>:
>> Hi Lukasz,
>>
>> I have struts-tiles-1.3.8.jar loaded . . . is this what you mean?
>
> Yes, it should be sufficient, could you post your struts config? Below
> is extract from the log you sent me.
>
> FATAL main org.apache.struts.tiles.TilesPlugin - TilesPlugin :
> Specified RequestProcessor not compatible with TilesRequestProcessor
> ERROR main org.apache.struts.action.ActionServlet - Unable to
> initialize Struts ActionServlet due to an unexpected exception or
> error thrown, so marking the servlet as unavailable.  Most likely,
> this is due to an incorrect or missing library dependency.
> javax.servlet.ServletException: TilesPlugin : Specified
> RequestProcessor not compatible with TilesRequestProcessor
>        at org.apache.struts.tiles.TilesPlugin.initRequestProcessorClass(TilesPlugin.java:382)
>        at org.apache.struts.tiles.TilesPlugin.init(TilesPlugin.java:137)
>        at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:871)
>        at org.apache.struts.action.ActionServlet.init(ActionServlet.java:359)
>        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
>        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
>        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
>        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
>        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
>        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
>        at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
>        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
>        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>        at org.apache.catalina.core.StandardService.start(StandardService.java:448)
>        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
>        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
>        at java.lang.reflect.Method.invoke(Method.java:599)
>        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
>        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
>
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
> Kapituła Javarsovia 2010 http://javarsovia.pl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Struts Tiles Problem

Posted by Lukasz Lenart <lu...@googlemail.com>.
2010/11/8 Andy T <ve...@gmail.com>:
> Hi Lukasz,
>
> I have struts-tiles-1.3.8.jar loaded . . . is this what you mean?

Yes, it should be sufficient, could you post your struts config? Below
is extract from the log you sent me.

FATAL main org.apache.struts.tiles.TilesPlugin - TilesPlugin :
Specified RequestProcessor not compatible with TilesRequestProcessor
ERROR main org.apache.struts.action.ActionServlet - Unable to
initialize Struts ActionServlet due to an unexpected exception or
error thrown, so marking the servlet as unavailable.  Most likely,
this is due to an incorrect or missing library dependency.
javax.servlet.ServletException: TilesPlugin : Specified
RequestProcessor not compatible with TilesRequestProcessor
	at org.apache.struts.tiles.TilesPlugin.initRequestProcessorClass(TilesPlugin.java:382)
	at org.apache.struts.tiles.TilesPlugin.init(TilesPlugin.java:137)
	at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:871)
	at org.apache.struts.action.ActionServlet.init(ActionServlet.java:359)
	at javax.servlet.GenericServlet.init(GenericServlet.java:212)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:448)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:599)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)



Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Kapituła Javarsovia 2010 http://javarsovia.pl

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


Re: Struts Tiles Problem

Posted by Andy T <ve...@gmail.com>.
Thanks to all who have responded thus far . . .

I think I forgot to add the Tiles Plugin to my struts-config.xml file.
 However when I do this I get  "HTTP Status 404 - Servlet action is
not available" . . .







On Sat, Nov 6, 2010 at 2:47 AM, Lukasz Lenart
<lu...@googlemail.com> wrote:
> 2010/11/5 Rafael Medeiros <me...@gmail.com>:
>> How to use plugin-tiles in struts 1.3.8:
>
> Check the documentation
> http://struts.apache.org/1.x/struts-tiles/installation.html
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
> Kapituła Javarsovia 2010 http://javarsovia.pl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Struts Tiles Problem

Posted by Lukasz Lenart <lu...@googlemail.com>.
2010/11/5 Rafael Medeiros <me...@gmail.com>:
> How to use plugin-tiles in struts 1.3.8:

Check the documentation
http://struts.apache.org/1.x/struts-tiles/installation.html


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Kapituła Javarsovia 2010 http://javarsovia.pl

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


Re: Struts Tiles Problem

Posted by Rafael Medeiros <me...@gmail.com>.
How to use plugin-tiles in struts 1.3.8:

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

*web.xml*
    <servlet>
        <servlet-name>action</servlet-name>

<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/config/struts-config.xml,
            /WEB-INF/config/struts-config-manter-usuario.xml
            </param-value>
        </init-param>
        <init-param>
            <param-name>convertNull</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>chainConfig</param-name>

<param-value>org/apache/struts/tiles/chain-config.xml</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>

*tiles.xml*
    <definition name="curriculo.layout.internet"
template="/Webcontent/paginas/layout/layoutCurriculoInternet.jsp">
        <put name="header" value="/Webcontent/paginas/comum/header.jsp"/>
        <put name="menu"
value="/Webcontent/paginas/comum/menuInternet.jsp"/>
        <put name="dinamico" value=""/>
        <put name="rodape" value="/Webcontent/paginas/comum/rodape.jsp"/>
    </definition>

    <definition name="curriculo.internet.usuario"
extends="curriculo.layout.internet">
        <put name="dinamico"
value="/Webcontent/internet/manterUsuarios/cadastroUsuario.jsp"/>
    </definition>

*action*
        <action path="/cadastrarUsuario"
                type="br.gov.curriculo.action.ManterUsuarioAction"
                name="usuarioForm"
                scope="request"
                input="curriculo.cadastro.usuario"
                cancellable="true"
                validate="true">
                <forward name="success" path="curriculo.internet.usuario"/>
        </action>

*template:*
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <tiles:insert name="header"/>
    </head>
    <body>
        <div id="wrap">
            <tiles:insert name="menu"/>
            <div id="main">
                <tiles:insert name="dinamico"/>
            </div>
        </div>
        <tiles:insert name="rodape"/>
    </body>
</html>

good luck!

Atenciosamente,

Rafael Nunes
I'm free - Linux
http://www.linkedin.com/in/mederafael


On Fri, Nov 5, 2010 at 4:15 PM, Dave Newton <da...@gmail.com> wrote:

> Is the Tiles plugin not required for S1.3? It's been several years since
> I've used Struts 1 (I hope you're not using it for a new project?)
>
> Dave
> On Nov 5, 2010 1:05 PM, "Andy T" <ve...@gmail.com> wrote:
> > Hi All,
> >
> > I'm having a bit of trouble trying to get my tiles to work with Struts
> > and wondered if anyone could help.
> >
> > The relevant files are shown below:
> >
> > **** Web.xml ****
> >
> > [code]
> > <?xml version="1.0" encoding="UTF-8"?>
> > <web-app id="WebApp_ID" version="2.4"
> > xmlns="http://java.sun.com/xml/ns/j2ee"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> > http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
> > <display-name>MiniHR</display-name>
> > <servlet>
> > <servlet-name>action</servlet-name>
> > <servlet-class>
> > org.apache.struts.action.ActionServlet</servlet-class>
> > <init-param>
> > <param-name>config</param-name>
> > <param-value>/WEB-INF/struts-config.xml</param-value>
> > </init-param>
> > <init-param>
> > <param-name>chainConfig</param-name>
> > <param-value>org/apache/struts/tiles/chain-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>
> >
> >
> > <servlet>
> > <servlet-name>tiles</servlet-name>
> > <servlet-class>org.apache.tiles.web.startup.TilesServlet</servlet-class>
> > <init-param>
> > <param-name>
> > org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
> > </param-name>
> > <param-value>
> > /WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml
> > </param-value>
> > </init-param>
> > <load-on-startup>1</load-on-startup>
> >
> >
> >
> > </servlet>
> >
> >
> >
> >
> >
> > <servlet-mapping>
> > <servlet-name>action</servlet-name>
> > <url-pattern>*.do</url-pattern>
> > </servlet-mapping>
> > <welcome-file-list>
> > <welcome-file>index.html</welcome-file>
> > <welcome-file>index.htm</welcome-file>
> > <welcome-file>index.jsp</welcome-file>
> > <welcome-file>default.html</welcome-file>
> > <welcome-file>default.htm</welcome-file>
> > <welcome-file>default.jsp</welcome-file>
> > </welcome-file-list>
> >
> > </web-app>
> > [/code]
> >
> >
> > **** tiles-defs.xml ****
> >
> > [code]
> > <?xml version="1.0"?>
> >
> > <!DOCTYPE tiles-definitions PUBLIC
> > "-//Apache Software Foundation//DTD Tiles Configuration 1.3//EN"
> > "http://struts.apache.org/dtds/tiles-config_1_3.dtd">
> >
> > <tiles-definitions>
> >
> > <definition name="Home" template="/template.jsp">
> > <put name="title" value="" />
> > <put name="header" value="/header.jsp" />
> > <put name="menu" value="/menu.jsp" />
> > <put name="leftnav" value="/leftnav.jsp" />
> > <put name="body" value="" />
> > <put name="footer" value="/footer.jsp" />
> > </definition>
> >
> >
> > <definition name="AddEnhancement" extends="Home">
> > <put name="title" value="Tiles tutorial homepage" />
> > <put name="body" value="/addenhancement.jsp" />
> > </definition>
> >
> >
> > </tiles-definitions>
> > [/code]
> >
> >
> > **** struts-config.xml ****
> >
> > [code]
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD
> > Struts Configuration 1.3//EN"
> > "http://struts.apache.org/dtds/struts-config_1_3.dtd">
> > <struts-config>
> >
> > <form-beans>
> >
> > (Form Beans Here)
> >
> > </form-beans>
> >
> > <global-exceptions>
> >
> > </global-exceptions>
> >
> > <global-forwards>
> > <forward name="login" path="/login.jsp"/>
> > </global-forwards>
> >
> > <action-mappings>
> >
> >
> > <action path="/initializeaddenhancement"
> > parameter="method"
> > type="EricEnhancement.struts.EnhancementAction"
> > cancellable="true"
> > validate="false">
> > <forward name="success" path="AddEnhancement"/>
> > <forward name="failure" path="/submitpage.jsp"/>
> > </action>
> >
> >
> > <action path="/Login"
> > input="/login.jsp"
> > type="EricEnhancement.struts.LoginAction"
> > name = "LoginForm"
> > cancellable="true"
> > validate="true">
> > <forward name="success" path="Home"/>
> > <forward name="failure" path="/login.jsp"/>
> > </action>
> >
> >
> > </action-mappings>
> >
> > <controller>
> > <set-property property="processorClass"
> > value="gov.ohio.odjfs.EricEnhancement.util.CustomRequestProcessor"/>
> > </controller>
> >
> > <message-resources
> >
>
> parameter="ericenhancements.resources.MessageResources"></message-resources>
> >
> > <plug-in className="net.sf.navigator.menu.MenuPlugIn">
> > <set-property property="menuConfig" value="/WEB-INF/menu-config.xml"/>
> > </plug-in>
> >
> > <!-- Validator Configuration -->
> > <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> > <set-property property="pathnames"
> > value="/org/apache/struts/validator/validator-rules.xml,
> > /WEB-INF/validation.xml"/>
> > </plug-in>
> >
> >
> >
> > </struts-config>
> > [/code]
> >
> >
> >
> > I'm using struts-tiles-1.3.8.jar and when I run the above I get:
> > "java.lang.IllegalArgumentException: Path Home does not start with a
> > "/" character"
> >
> > Can anyone help me with this?
> >
> > Thanks,
> >
> > Rob
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
>

Re: Struts Tiles Problem

Posted by Dave Newton <da...@gmail.com>.
Is the Tiles plugin not required for S1.3? It's been several years since
I've used Struts 1 (I hope you're not using it for a new project?)

Dave
On Nov 5, 2010 1:05 PM, "Andy T" <ve...@gmail.com> wrote:
> Hi All,
>
> I'm having a bit of trouble trying to get my tiles to work with Struts
> and wondered if anyone could help.
>
> The relevant files are shown below:
>
> **** Web.xml ****
>
> [code]
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app id="WebApp_ID" version="2.4"
> xmlns="http://java.sun.com/xml/ns/j2ee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
> <display-name>MiniHR</display-name>
> <servlet>
> <servlet-name>action</servlet-name>
> <servlet-class>
> org.apache.struts.action.ActionServlet</servlet-class>
> <init-param>
> <param-name>config</param-name>
> <param-value>/WEB-INF/struts-config.xml</param-value>
> </init-param>
> <init-param>
> <param-name>chainConfig</param-name>
> <param-value>org/apache/struts/tiles/chain-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>
>
>
> <servlet>
> <servlet-name>tiles</servlet-name>
> <servlet-class>org.apache.tiles.web.startup.TilesServlet</servlet-class>
> <init-param>
> <param-name>
> org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
> </param-name>
> <param-value>
> /WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml
> </param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
>
>
>
> </servlet>
>
>
>
>
>
> <servlet-mapping>
> <servlet-name>action</servlet-name>
> <url-pattern>*.do</url-pattern>
> </servlet-mapping>
> <welcome-file-list>
> <welcome-file>index.html</welcome-file>
> <welcome-file>index.htm</welcome-file>
> <welcome-file>index.jsp</welcome-file>
> <welcome-file>default.html</welcome-file>
> <welcome-file>default.htm</welcome-file>
> <welcome-file>default.jsp</welcome-file>
> </welcome-file-list>
>
> </web-app>
> [/code]
>
>
> **** tiles-defs.xml ****
>
> [code]
> <?xml version="1.0"?>
>
> <!DOCTYPE tiles-definitions PUBLIC
> "-//Apache Software Foundation//DTD Tiles Configuration 1.3//EN"
> "http://struts.apache.org/dtds/tiles-config_1_3.dtd">
>
> <tiles-definitions>
>
> <definition name="Home" template="/template.jsp">
> <put name="title" value="" />
> <put name="header" value="/header.jsp" />
> <put name="menu" value="/menu.jsp" />
> <put name="leftnav" value="/leftnav.jsp" />
> <put name="body" value="" />
> <put name="footer" value="/footer.jsp" />
> </definition>
>
>
> <definition name="AddEnhancement" extends="Home">
> <put name="title" value="Tiles tutorial homepage" />
> <put name="body" value="/addenhancement.jsp" />
> </definition>
>
>
> </tiles-definitions>
> [/code]
>
>
> **** struts-config.xml ****
>
> [code]
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD
> Struts Configuration 1.3//EN"
> "http://struts.apache.org/dtds/struts-config_1_3.dtd">
> <struts-config>
>
> <form-beans>
>
> (Form Beans Here)
>
> </form-beans>
>
> <global-exceptions>
>
> </global-exceptions>
>
> <global-forwards>
> <forward name="login" path="/login.jsp"/>
> </global-forwards>
>
> <action-mappings>
>
>
> <action path="/initializeaddenhancement"
> parameter="method"
> type="EricEnhancement.struts.EnhancementAction"
> cancellable="true"
> validate="false">
> <forward name="success" path="AddEnhancement"/>
> <forward name="failure" path="/submitpage.jsp"/>
> </action>
>
>
> <action path="/Login"
> input="/login.jsp"
> type="EricEnhancement.struts.LoginAction"
> name = "LoginForm"
> cancellable="true"
> validate="true">
> <forward name="success" path="Home"/>
> <forward name="failure" path="/login.jsp"/>
> </action>
>
>
> </action-mappings>
>
> <controller>
> <set-property property="processorClass"
> value="gov.ohio.odjfs.EricEnhancement.util.CustomRequestProcessor"/>
> </controller>
>
> <message-resources
>
parameter="ericenhancements.resources.MessageResources"></message-resources>
>
> <plug-in className="net.sf.navigator.menu.MenuPlugIn">
> <set-property property="menuConfig" value="/WEB-INF/menu-config.xml"/>
> </plug-in>
>
> <!-- Validator Configuration -->
> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property property="pathnames"
> value="/org/apache/struts/validator/validator-rules.xml,
> /WEB-INF/validation.xml"/>
> </plug-in>
>
>
>
> </struts-config>
> [/code]
>
>
>
> I'm using struts-tiles-1.3.8.jar and when I run the above I get:
> "java.lang.IllegalArgumentException: Path Home does not start with a
> "/" character"
>
> Can anyone help me with this?
>
> Thanks,
>
> Rob
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>