tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken McWilliams <ken.mcwilli...@gmail.com>
Subject Re: Getting OGNL working tiles 2.2.2
Date Sun, 08 Apr 2012 23:28:11 GMT
Hey thanks for the follow up Nick! I'm not sure what the difference is
but... I've lost wildcard support, although I now have OGNL support...

Here is a tiles.xml I'm using for testing:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
       "http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
<tiles-definitions>
    <definition name="baseLayout"
template="/WEB-INF/content/tiles/template.jsp">
        <put-attribute name="title" value="Default Title"/>
        <put-attribute name="header"
value="/WEB-INF/content/tiles/header.jsp"/>
        <put-attribute name="body" value="/WEB-INF/content/tiles/body.jsp"/>
        <put-attribute name="footer"
value="/WEB-INF/content/tiles/footer.jsp"/>
        <put-attribute name="variable"  expression="OGNL:greeting"/>
    </definition>
    <definition name="test" extends="baseLayout">
        <put-attribute name="title" value="Test Title"/>
    </definition>
    <definition name="package/*" extends="baseLayout">
        <put-attribute name="title" value="{1}" type="string"/>
    </definition>
    <definition name="" extends="baseLayout">
    </definition>
    <definition name="magic" extends="baseLayout">
        <put-attribute name="variable" value="OGNL:cows"/>
    </definition>
</tiles-definitions>

Before changing the web.xml listener class to
org.apache.tiles.extras.complete.CompleteAutoloadTilesListener

This would work:

<definition name="package/*" extends="baseLayout"> worked but now I get...

*org.apache.tiles.definition.NoSuchDefinitionException: package/hello

*However if I change the listener back to
org.apache.tiles.web.startup.TilesListener, then it works again.

How to fix that?

On Sun, Apr 8, 2012 at 4:30 PM, Ken McWilliams <ken.mcwilliams@gmail.com>wrote:

> Opps... I meant to say:
>
> <listener-class>org.apache.tiles.extras.complete.CompleteAutoloadTilesListener</listener-class>
>
>
> On Sun, Apr 8, 2012 at 4:30 PM, Ken McWilliams <ken.mcwilliams@gmail.com>wrote:
>
>> NEVER MIND... You guys already did all the work!
>>
>>
>> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
>>
>> I think there are a lot of struts2 people who would like to use these
>> features? How do I contribute to the Apache tiles wiki? I want to create a
>> minimal struts2 example. Showing struts2 wild card support and OGNL (since
>> it is now all working... and was quite obvious once I looked).
>>
>>
>> On Sun, Apr 8, 2012 at 3:59 PM, Ken McWilliams <ken.mcwilliams@gmail.com>wrote:
>>
>>> Issue getting tiles working in Tiles 2.2.2 : "PWC1223: Path
>>> classpath*:META-INF/**/tiles*.xml does not start with '/'"
>>>
>>> Maven is used for the build.
>>>
>>> Here is the stack trace:
>>>
>>> SEVERE: java.net.MalformedURLException: PWC1223: Path
>>> classpath*:META-INF/**/tiles*.xml does not start with '/'
>>>     at
>>> org.apache.catalina.core.StandardContext.getResource(StandardContext.java:6922)
>>>     at
>>> org.apache.catalina.core.ApplicationContext.getResource(ApplicationContext.java:382)
>>>     at
>>> org.apache.catalina.core.ApplicationContextFacade.getResource(ApplicationContextFacade.java:260)
>>>     at
>>> org.apache.tiles.servlet.context.ServletTilesApplicationContext.getResource(ServletTilesApplicationContext.java:100)
>>>     at
>>> org.apache.tiles.servlet.context.ServletTilesApplicationContext.getResources(ServletTilesApplicationContext.java:106)
>>>     at
>>> com.kenmcwilliams.tiles.extras.complete.CompleteAutoloadTilesContainerFactory.getSourceURLs(CompleteAutoloadTilesContainerFactory.java:223)
>>>     at
>>> org.apache.tiles.factory.BasicTilesContainerFactory.createLocaleDefinitionDao(BasicTilesContainerFactory.java:298)
>>>     at
>>> org.apache.tiles.factory.BasicTilesContainerFactory.createDefinitionsFactory(BasicTilesContainerFactory.java:242)
>>>     at
>>> org.apache.tiles.factory.BasicTilesContainerFactory.createContainer(BasicTilesContainerFactory.java:104)
>>>     at
>>> org.apache.tiles.startup.AbstractTilesInitializer.createContainer(AbstractTilesInitializer.java:124)
>>>     at
>>> org.apache.tiles.startup.AbstractTilesInitializer.initialize(AbstractTilesInitializer.java:70)
>>>     at
>>> org.apache.tiles.web.startup.AbstractTilesListener.contextInitialized(AbstractTilesListener.java:62)
>>>     at
>>> org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:4750)
>>>
>>> Here is the Web.xml
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>>>     <listener>
>>>
>>> <listener-class>com.kenmcwilliams.tiles.web.startup.TilesListener</listener-class>
>>>     </listener>
>>>     <filter>
>>>         <filter-name>struts2</filter-name>
>>>
>>> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
>>>     </filter>
>>>     <filter-mapping>
>>>         <filter-name>struts2</filter-name>
>>>         <url-pattern>/*</url-pattern>
>>>     </filter-mapping>
>>> </web-app>
>>>
>>> From the above here is my
>>>
>>>     package com.kenmcwilliams.tiles.web.startup;
>>>
>>>     import
>>> com.kenmcwilliams.tiles.extras.complete.CompleteAutoloadTilesContainerFactory;
>>>     import org.apache.tiles.TilesApplicationContext;
>>>     import org.apache.tiles.factory.AbstractTilesContainerFactory;
>>>     import org.apache.tiles.startup.AbstractTilesInitializer;
>>>     import org.apache.tiles.startup.TilesInitializer;
>>>     import org.apache.tiles.web.startup.AbstractTilesListener;
>>>
>>>     /**
>>>     * Listener for the initialization of the Tiles container.
>>>     */
>>>     public class TilesListener extends AbstractTilesListener {
>>>         @Override
>>>         protected TilesInitializer createTilesInitializer() {
>>>             return new AbstractTilesInitializer() {
>>>
>>>                 @Override
>>>                 protected AbstractTilesContainerFactory
>>> createContainerFactory(TilesApplicationContext context) {
>>>                     return new CompleteAutoloadTilesContainerFactory();
>>>                 }
>>>             };
>>>         }
>>>     }
>>>
>>>
>>> Note: I am using my own CompleteAutoloadTilesContainerFactory to try and
>>> get around this issue, I did this after reading:
>>> https://issues.apache.org/jira/browse/TILES-493 (but I am using tiles
>>> 2.2.2 so that shouldn't affect me, but I took the advice there and had the
>>> container check if those collections were null and if so initialised
>>> them).  if I use
>>> org.apache.tiles.extras.complete.CompleteAutoloadTilesContainerFactory
>>> then: I still get the same error...
>>>
>>> Caused by: org.apache.tiles.definition.DefinitionsFactoryException:
>>> Cannot load definition URLs
>>>     at
>>> org.apache.tiles.extras.complete.CompleteAutoloadTilesContainerFactory.getSourceURLs(CompleteAutoloadTilesContainerFactory.java:244)
>>>     at
>>> org.apache.tiles.factory.BasicTilesContainerFactory.createLocaleDefinitionDao(BasicTilesContainerFactory.java:298)
>>>     at
>>> org.apache.tiles.factory.BasicTilesContainerFactory.createDefinitionsFactory(BasicTilesContainerFactory.java:242)
>>>     at
>>> org.apache.tiles.factory.BasicTilesContainerFactory.createContainer(BasicTilesContainerFactory.java:104)
>>>     at
>>> org.apache.tiles.startup.AbstractTilesInitializer.createContainer(AbstractTilesInitializer.java:124)
>>>     at
>>> org.apache.tiles.startup.AbstractTilesInitializer.initialize(AbstractTilesInitializer.java:70)
>>>     at
>>> org.apache.tiles.web.startup.AbstractTilesListener.contextInitialized(AbstractTilesListener.java:62)
>>>     at
>>> org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:4750)
>>>     at
>>> com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:550)
>>>     at
>>> org.apache.catalina.core.StandardContext.start(StandardContext.java:5366)
>>>     ... 39 more
>>> Caused by: java.net.MalformedURLException: PWC1223: Path
>>> classpath*:META-INF/**/tiles*.xml does not start with '/'
>>>     at
>>> org.apache.catalina.core.StandardContext.getResource(StandardContext.java:6922)
>>>     at
>>> org.apache.catalina.core.ApplicationContext.getResource(ApplicationContext.java:382)
>>>     at
>>> org.apache.catalina.core.ApplicationContextFacade.getResource(ApplicationContextFacade.java:260)
>>>     at
>>> org.apache.tiles.servlet.context.ServletTilesApplicationContext.getResource(ServletTilesApplicationContext.java:100)
>>>     at
>>> org.apache.tiles.servlet.context.ServletTilesApplicationContext.getResources(ServletTilesApplicationContext.java:106)
>>>     at
>>> org.apache.tiles.extras.complete.CompleteAutoloadTilesContainerFactory.getSourceURLs(CompleteAutoloadTilesContainerFactory.java:233)
>>>
>>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message