Announcement Announcement Module
Collapse
No announcement yet.
Struts tiles to Tiles migration - Changes in Spring support classes. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Struts tiles to Tiles migration - Changes in Spring support classes.

    The project I am working on has been using Struts tiles 1.3. Since I am trying to upgrade from Spring 2.1 to Spring 3.0.x, I am trying to migrate to Tiles 2.2. The migration guide[http://tiles.apache.org/2.2/framewor...on/index.html] is helping me along. However, I seem to have hit a wall and am looking for help. Here are the details:

    This is the tilesConfigurer we were using,

    Code:
    <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles.TilesConfigurer">
            <property name="factoryClass">
                <value>org.apache.struts.tiles.xmlDefinition.I18nFactorySet</value>
            </property>
            <property name="definitions">
                <list>
                    <value>/WEB-INF/tiles-defs.xml</value>
                </list>
            </property>
    </bean>
    Since, the above class is deprecated in Spring 3.0.x, I changed it to use org.springframework.web.servlet.view.tiles2.TilesC onfigurer

    The tiles2.TilesConfigurer does not have a setFactoryClass method unlike tiles.TilesConfigurer which is now deprecated.

    I have looked up the tiles2.TilesConfigurer api, which now has the methods, setDefinitionsFactoryClass and setPreparerFactoryClass. Not only I am unable to decide which one is relevant here, I can't find an equivalent class for org.apache.struts.tiles.xmlDefinition.I18nFactoryS et. Is there something of this sort directly available in Tiles 2.2, or do I need to revisit some of my existing code with an equivalent that is available in Tiles 2.2?

    Any pointer will be appreciated.

    Thank you,
    Sundeep

  • #2
    Not sure how this question is related to spring. Tiles changed considerably internally between 1.x and 2.0 and even further between the 2.x series. The org.apache.struts.tiles.xmlDefinition.I18nFactoryS et has nothing to do with spring as it is a tiles class.

    I can't find an equivalent class for org.apache.struts.tiles.xmlDefinition.I18nFactoryS et ...
    Neither could I at least not from the description it might be that it is the default now and supported as such (maybe you need to take a look at the internals of the DefinitionFactory implementations to see what happens inside).

    I'm sure you need a definition factory as that reads/creates the definitions from the tiles-defs.xml file although it delegates to a reader (but in my experience there is some coupling between the 2).

    Edit: Some further reading on the tiles website has the answer, use the UrlDefinitionsFactory it is deprecated but has instructions on what to do.
    Last edited by Marten Deinum; May 24th, 2012, 09:26 AM.

    Comment


    • #3
      I believed it was related to Spring as the old package org.springframework.web.servlet.view.tiles was deprecated for a new one org.springframework.web.servlet.view.tiles2 and in the new TilesConfigurer class there is no such method 'setFactoryClass', I was wondering if some one could have faced this situation or knew about what do about this one. I think the solution has to come partly from both Spring and Tiles. I might be wrong, but I had to check. First, I will need to choose the right method and then see what to feed to it. FYI - I posted it to the Tiles community right before asking here. Haven't got any reply yet.

      I will try and understand about DefinitionFactory meanwhile. As UrlDefinitionsFactory is deprecated, I will have to look into UnresolvingLocaleDefinitionsFactory or ResolvingLocaleUrlDefinitionDAO(and those diagrams/relations of course). Thanks for the pointers.

      Between, Thanks for the speedy reply and taking time to check the Tiles website for this.

      Thanks,
      Sundeep

      Comment


      • #4
        Solved - Not a Spring related problem.

        Hi,

        A gentleman from the Tiles community helped me solve this problem. As Marten said, this is not related to Spring. Sorry for the false alarm.

        For those interested in the solution, the factoryClass org.apache.struts.tiles.xmlDefinition.I18nFactoryS et is now supported OOB in Tiles 2.2. So, we can safely remove the property. The final XML element looks like below

        Code:
        <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
                <property name="definitions">
                    <list>
                        <value>/WEB-INF/tiles-defs.xml</value>
                    </list>
                </property>
        </bean>
        Observe that the new class is tiles2.TilesConfigurer.

        Thank you,
        Sundeep

        Comment

        Working...
        X