You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "balaji.m.cs" <ba...@gmail.com> on 2008/04/04 07:03:51 UTC

Tiles in 1.3.9

I need to integrate tiles in struts 1.3.9 i have included the jar files and
tlds as needed but im getting the exception...
     i don know whats the error....


Apr 4, 2008 10:25:48 AM org.apache.struts.action.ActionServlet initChain
INFO: Loading chain catalog from code-source:/C:/Jdeveloper
1014/jdev/mywork/test/ViewController/public_html/WEB-INF/lib/struts-core-1.3.9.jar!org/apache/struts/chain/chain-config.xml
Apr 4, 2008 10:25:48 AM org.apache.struts.tiles.TilesPlugin
initDefinitionsFactory
INFO: Tiles definition factory loaded for module ''.
Apr 4, 2008 10:25:49 AM org.apache.struts.chain.ComposableRequestProcessor
init
INFO: Initializing composable request processor for module prefix ''
Apr 4, 2008 10:25:49 AM
org.apache.struts.chain.commands.AbstractExceptionHandler execute
WARNING: Unhandled exception
java.lang.IllegalArgumentException: path must begin with a "/"
	at
com.evermind.server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:1532)
	at
org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:107)
	at
org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
	at
org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
	at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
	at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
	at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
	at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
	at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:450)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
	at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
	at
com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
	at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
	at
com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
	at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
	at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
	at
oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
	at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
	at java.lang.Thread.run(Thread.java:595)
Apr 4, 2008 10:25:49 AM org.apache.struts.chain.commands.ExceptionCatcher
postprocess
WARNING: Exception from exceptionCommand 'servlet-exception'
java.lang.IllegalArgumentException: path must begin with a "/"
	at
com.evermind.server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:1532)
	at
org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:107)
	at
org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
	at
org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
	at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
	at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
	at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
	at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
	at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:450)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
	at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
	at
com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
	at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
	at
com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
	at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
	at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
	at
oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
	at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
	at java.lang.Thread.run(Thread.java:595)


my sample code.


web.xml

<?xml version = '1.0' encoding = 'windows-1252'?>
<web-app 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" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee">
    <description>Empty web.xml file for Web Application</description>
    <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>
        <load-on-startup>1</load-on-startup>
    </servlet>
   
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>35</session-timeout>
    </session-config>
 <jsp-config>
        <taglib>
            <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
            
        </taglib>
    </jsp-config>
    <mime-mapping>
        <extension>html</extension>
        <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>txt</extension>
        <mime-type>text/plain</mime-type>
    </mime-mapping>
</web-app>

struts-config.xml

<?xml version="1.0" encoding="windows-1252" ?>
<!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>
    <action-mappings>
        <action path="/baselayout"
            forward="tiles-defs"/>
  </action-mappings>
  <message-resources parameter="view.ApplicationResources"/>
  <plug-in className="org.apache.struts.tiles.TilesPlugin">
    <set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml"/>
    <set-property property="moduleAware" value="true" />
    <set-property property="definitions-parser-validate" value="true" />
   </plug-in>
</struts-config>


tiles-defs.xml

<?xml version="1.0" encoding="windows-1252" ?>
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles
Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
<tiles-definitions>
  <definition name="tiles-defs" path="/jsp/baseLayout.jsp">
    <put name="top" value="/jsp/top.jsp"/>
    <put name="bottom" value="/jsp/bottom.jsp"/>
  </definition>
</tiles-definitions>


baseLayout.jsp

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
charset=windows-1252"/>
    <title>baseLayout</title>
  </head>
  <body>
    <tiles:insert attribute="top"/>
    <tiles:insert attribute="bottom"/>
  </body>
</html>

my top and bottom layout jsps are just sample texted files... 

can any one help me where i have made any mistakes...

thanks
Balaji.M


-- 
View this message in context: http://www.nabble.com/Tiles-in-1.3.9-tp16483416p16483416.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Tiles in 1.3.9

Posted by Antonio Petrelli <an...@gmail.com>.
2008/4/4, Mihai Scripca <mi...@ucs.ro>:
>
> dont you think it would be better practice naming tiles like this:
> tile.def (*.def are like .jsp but virtual pages)
>
> and only class tiles should be named with dot first like this .class-name?



Well, there is no guideline/best practice defined for Tiles definition
names, so you can do your own :-D

Antonio

Re: Tiles in 1.3.9

Posted by Mihai Scripca <mi...@ucs.ro>.
dont you think it would be better practice naming tiles like this:
tile.def (*.def are like .jsp but virtual pages)

and only class tiles should be named with dot first like this .class-name?
> i point the issue by myself.
> the main issue is i have not given the 
>
> <controller processorClass="org.apache.struts.action.TilesRequestProcessor"
> bufferSize="4096" debug="0"/>
> in struts-config.xml.
> after i give its working... thanks for giving me the best pratices on
> tiles...
>
> if u still find any issues in my code pls say so that i can have a
> correction....
>
> Lukasz Lenart wrote:
>   
>> Hi,
>>
>>     
>>>  <struts-config>
>>>     <action-mappings>
>>>         <action path="/baselayout"
>>>       
>>              forward=".tiles-defs"/>
>>     
>>>   </action-mappings>
>>>       
>>>  tiles-defs.xml
>>>       
>>    <definition name=".tiles-defs" path="/jsp/baseLayout.jsp">
>>
>> There is good practice to start Tiles definitions with dot -> .tiles-defs
>> I don't see ant forwards in your struts-config.xml, could you past them
>> here?
>>
>>
>> Regards
>> -- 
>> Lukasz
>>
>> http://www.linkedin.com/in/lukaszlenart
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>     
>
>   


Re: Tiles in 1.3.9

Posted by "balaji.m.cs" <ba...@gmail.com>.
i point the issue by myself.
the main issue is i have not given the 

<controller processorClass="org.apache.struts.action.TilesRequestProcessor"
bufferSize="4096" debug="0"/>
in struts-config.xml.
after i give its working... thanks for giving me the best pratices on
tiles...

if u still find any issues in my code pls say so that i can have a
correction....

Lukasz Lenart wrote:
> 
> Hi,
> 
>>  <struts-config>
>>     <action-mappings>
>>         <action path="/baselayout"
>              forward=".tiles-defs"/>
>>   </action-mappings>
> 
>>  tiles-defs.xml
>    <definition name=".tiles-defs" path="/jsp/baseLayout.jsp">
> 
> There is good practice to start Tiles definitions with dot -> .tiles-defs
> I don't see ant forwards in your struts-config.xml, could you past them
> here?
> 
> 
> Regards
> -- 
> Lukasz
> 
> http://www.linkedin.com/in/lukaszlenart
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Tiles-in-1.3.9-tp16483416p16490795.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Tiles in 1.3.9

Posted by Antonio Petrelli <an...@gmail.com>.
2008/4/4, Lukasz Lenart <lu...@googlemail.com>:
>
> Hi,
>
>
> >  <struts-config>
> >     <action-mappings>
> >         <action path="/baselayout"
>              forward=".tiles-defs"/>
> >   </action-mappings>
>
>
> >  tiles-defs.xml
>
>    <definition name=".tiles-defs" path="/jsp/baseLayout.jsp">



Good catch Lukasz! Now I remember that:
*Struts-Tiles does not support forward actions, only forwards inside normal
actions*

Antonio

Re: Tiles in 1.3.9

Posted by Lukasz Lenart <lu...@googlemail.com>.
Hi,

>  <struts-config>
>     <action-mappings>
>         <action path="/baselayout"
             forward=".tiles-defs"/>
>   </action-mappings>

>  tiles-defs.xml
   <definition name=".tiles-defs" path="/jsp/baseLayout.jsp">

There is good practice to start Tiles definitions with dot -> .tiles-defs
I don't see ant forwards in your struts-config.xml, could you past them here?


Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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


Re: Tiles in 1.3.9

Posted by Antonio Petrelli <an...@gmail.com>.
2008/4/4, balaji.m.cs <ba...@gmail.com>:
>
> java.lang.IllegalArgumentException: path must begin with a "/"



What's the path that you are calling?

Antonio