You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sameer ali <ju...@gmail.com> on 2013/01/12 22:09:31 UTC
Struts 1.3 Tiles not working
Hi,
I am Unable to get tiles to work in my application . I am using Struts 1.3
, stuts-tiles-1.3.10.jar is in the lib folder I am building this
application on top of struts-blank.war
The struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
<!--
This is a blank Struts configuration file with an example
welcome action/page and other commented sample elements.
Struts Validator is configured using the factory defaults
and is ready-to-use.
NOTE: If you have a generator tool to create the corresponding Java
classes
for you, you could include the details in the "form-bean" declarations.
Otherwise, you would only define the "form-bean" element itself, with
the
corresponding "name" and "type" attributes, as shown here.
-->
<struts-config>
<!-- ================================================ Form Bean Definitions
-->
<form-beans>
<form-bean name="searchForm"
type="com.jamesholmes.minihr.SearchForm"/>
<!-- sample form bean descriptor for an ActionForm
<form-bean
name="inputForm"
type="app.InputForm"/>
end sample -->
<!-- sample form bean descriptor for a DynaActionForm
<form-bean
name="logonForm"
type="org.apache.struts.action.DynaActionForm">
<form-property
name="username"
type="java.lang.String"/>
<form-property
name="password"
type="java.lang.String"/>
</form-bean>
end sample -->
</form-beans>
<!-- ========================================= Global Exception Definitions
-->
<global-exceptions>
<!-- sample exception handler
<exception
key="expired.password"
type="app.ExpiredPasswordException"
path="/changePassword.jsp"/>
end sample -->
</global-exceptions>
<!-- =========================================== Global Forward Definitions
-->
<global-forwards>
<!-- Default forward to "Welcome" action -->
<!-- Demonstrates using index.jsp to forward -->
<forward
name="welcome"
path="/Welcome.do"/>
<forward name="search" path="search.page"/>
</global-forwards>
<!-- =========================================== Action Mapping Definitions
-->
<action-mappings>
<!-- Default "Welcome" action -->
<!-- Forwards to Welcome.jsp -->
<action
path="/Welcome"
forward="/pages/Welcome.jsp"/>
<action path="/viewSearch"
type="org.apache.struts.actions.ForwardAction"
parameter="search.page"/>
<action path="/search"
type="com.jamesholmes.minihr.SearchAction"
name="searchForm"
scope="request"
validate="true"
input="search.page">
</action>
<!-- sample input and input submit actions
<action
path="/Input"
type="org.apache.struts.actions.ForwardAction"
parameter="/pages/Input.jsp"/>
<action
path="/InputSubmit"
type="app.InputAction"
name="inputForm"
scope="request"
validate="true"
input="/pages/Input.jsp"/>
<action
path="/edit*"
type="app.Edit{1}Action"
name="inputForm"
scope="request"
validate="true"
input="/pages/Edit{1}.jsp"/>
end samples -->
</action-mappings>
<!-- ======================================== Message Resources Definitions
-->
<message-resources parameter="MessageResources" />
<!-- =================================================== Validator plugin
-->
<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>
<!-- Tiles Configuration -->
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
<set-property property="definitions-parser-validate" value="true" />
<set-property property="moduleAware" value="true" />
</plug-in>
</struts-config>
tiles-defs.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 1.3//EN"
"http://struts.apache.org/dtds/tiles-config_1_3.dtd">
<!--
This is a blank Tiles definition file with a commented example.
-->
<tiles-definitions>
<!-- sample tiles definitions
<definition name=".mainLayout" path="/common/layouts/classicLayout.jsp">
<put name="title" value="Sample Page Title" />
<put name="header" value="/common/header.jsp" />
<put name="menu" value=".mainMenu" />
<put name="footer" value="/common/footer.jsp" />
<put name="body" value=".portal.body" />
</definition>
<definition name=".mainMenu" path="/common/layouts/vboxLayout.jsp" >
<putList name="list" >
<add value=".menu.links" />
<add value=".menu.taglib.references" />
<add value=".menu.printer.friendly" />
<add value=".menu.old.documents" />
</putList>
</definition>
<definition name="aPage" extends=".mainLayout">
<put name="title" value="Another Title" />
<put name="body" value=".aPage.body" />
</definition>
end samples -->
<definition name="baseLayout" path="/mainLayout.jsp">
<put name="title" value="" />
<put name="header" value="/header.jsp" />
<put name="body" value="" />
<put name="footer" value="/footer.jsp" />
</definition>
<definition name="search.page" extends="baseLayout">
<put name="title" value="Search Page" />
<put name="body" value="/searchBody.jsp" />
</definition>
</tiles-definitions>
I am not sure if tiles is being intialized properly this is all i get in
tomcat console regarding tiles
Jan 8, 2013 10:24:11 PM org.apache.struts.tiles.TilesPlugin
initDefinitionsFactory
INFO: Tiles definition factory loaded for module ''.
I guess something more should appear right ?
on accessing the application a forward action throws the following
exception
WARNING: Unhandled exception
java.lang.IllegalArgumentException: Path search.page does not start with a
"/" character
at
org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:431)
Have I missed something please help
Re: Struts 1.3 Tiles not working
Posted by sameer ali <ju...@gmail.com>.
Il'l keep that in mind the next time.
Sameer
On Tue, Jan 15, 2013 at 5:19 AM, Dave Newton <da...@gmail.com> wrote:
> Unrelated, but go ahead and take out all those comments that don't add
> anything to the question next time. Some of us read on mobile devices and
> useless vertical whitespace generally ends up in an automatic delete.
>
> Dave
>
Re: Struts 1.3 Tiles not working
Posted by Dave Newton <da...@gmail.com>.
Unrelated, but go ahead and take out all those comments that don't add
anything to the question next time. Some of us read on mobile devices and
useless vertical whitespace generally ends up in an automatic delete.
Dave
Fwd: Struts 1.3 Tiles not working
Posted by sameer ali <ju...@gmail.com>.
Hi,
I am Unable to get tiles to work in my application . I am using Struts 1.3
, stuts-tiles-1.3.10.jar is in the lib folder I am building this
application on top of struts-blank.war
The struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
<!--
This is a blank Struts configuration file with an example
welcome action/page and other commented sample elements.
Struts Validator is configured using the factory defaults
and is ready-to-use.
NOTE: If you have a generator tool to create the corresponding Java
classes
for you, you could include the details in the "form-bean" declarations.
Otherwise, you would only define the "form-bean" element itself, with
the
corresponding "name" and "type" attributes, as shown here.
-->
<struts-config>
<!-- ================================================ Form Bean Definitions
-->
<form-beans>
<form-bean name="searchForm"
type="com.jamesholmes.minihr.SearchForm"/>
<!-- sample form bean descriptor for an ActionForm
<form-bean
name="inputForm"
type="app.InputForm"/>
end sample -->
<!-- sample form bean descriptor for a DynaActionForm
<form-bean
name="logonForm"
type="org.apache.struts.action.DynaActionForm">
<form-property
name="username"
type="java.lang.String"/>
<form-property
name="password"
type="java.lang.String"/>
</form-bean>
end sample -->
</form-beans>
<!-- ========================================= Global Exception Definitions
-->
<global-exceptions>
<!-- sample exception handler
<exception
key="expired.password"
type="app.ExpiredPasswordException"
path="/changePassword.jsp"/>
end sample -->
</global-exceptions>
<!-- =========================================== Global Forward Definitions
-->
<global-forwards>
<!-- Default forward to "Welcome" action -->
<!-- Demonstrates using index.jsp to forward -->
<forward
name="welcome"
path="/Welcome.do"/>
<forward name="search" path="search.page"/>
</global-forwards>
<!-- =========================================== Action Mapping Definitions
-->
<action-mappings>
<!-- Default "Welcome" action -->
<!-- Forwards to Welcome.jsp -->
<action
path="/Welcome"
forward="/pages/Welcome.jsp"/>
<action path="/viewSearch"
type="org.apache.struts.actions.ForwardAction"
parameter="search.page"/>
<action path="/search"
type="com.jamesholmes.minihr.SearchAction"
name="searchForm"
scope="request"
validate="true"
input="search.page">
</action>
<!-- sample input and input submit actions
<action
path="/Input"
type="org.apache.struts.actions.ForwardAction"
parameter="/pages/Input.jsp"/>
<action
path="/InputSubmit"
type="app.InputAction"
name="inputForm"
scope="request"
validate="true"
input="/pages/Input.jsp"/>
<action
path="/edit*"
type="app.Edit{1}Action"
name="inputForm"
scope="request"
validate="true"
input="/pages/Edit{1}.jsp"/>
end samples -->
</action-mappings>
<!-- ======================================== Message Resources Definitions
-->
<message-resources parameter="MessageResources" />
<!-- =================================================== Validator plugin
-->
<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>
<!-- Tiles Configuration -->
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
<set-property property="definitions-parser-validate" value="true" />
<set-property property="moduleAware" value="true" />
</plug-in>
</struts-config>
tiles-defs.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 1.3//EN"
"http://struts.apache.org/dtds/tiles-config_1_3.dtd">
<!--
This is a blank Tiles definition file with a commented example.
-->
<tiles-definitions>
<!-- sample tiles definitions
<definition name=".mainLayout" path="/common/layouts/classicLayout.jsp">
<put name="title" value="Sample Page Title" />
<put name="header" value="/common/header.jsp" />
<put name="menu" value=".mainMenu" />
<put name="footer" value="/common/footer.jsp" />
<put name="body" value=".portal.body" />
</definition>
<definition name=".mainMenu" path="/common/layouts/vboxLayout.jsp" >
<putList name="list" >
<add value=".menu.links" />
<add value=".menu.taglib.references" />
<add value=".menu.printer.friendly" />
<add value=".menu.old.documents" />
</putList>
</definition>
<definition name="aPage" extends=".mainLayout">
<put name="title" value="Another Title" />
<put name="body" value=".aPage.body" />
</definition>
end samples -->
<definition name="baseLayout" path="/mainLayout.jsp">
<put name="title" value="" />
<put name="header" value="/header.jsp" />
<put name="body" value="" />
<put name="footer" value="/footer.jsp" />
</definition>
<definition name="search.page" extends="baseLayout">
<put name="title" value="Search Page" />
<put name="body" value="/searchBody.jsp" />
</definition>
</tiles-definitions>
I am not sure if tiles is being intialized properly this is all i get in
tomcat console regarding tiles
Jan 8, 2013 10:24:11 PM org.apache.struts.tiles.TilesPlugin
initDefinitionsFactory
INFO: Tiles definition factory loaded for module ''.
I guess something more should appear right ?
on accessing the application a forward action throws the following
exception
WARNING: Unhandled exception
java.lang.IllegalArgumentException: Path search.page does not start with a
"/" character
at
org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:431)
Have I missed something please help