0

I'm hoping someone can point me in the right direction here. Basically I keep getting a 404 returned from my request into my Spring controller. The controller returns the view name "showcardOverview". The request makes it into the controller without a problem. I cannot figure out why Tiles cannot resolve the view name to the tile definition.

Below are my config files:

TILE DEFS

<tiles-definitions>
    <definition name="base" template="/jsp/layouts/flagship.jsp">
        <put-attribute name="head" value="/jsp/assets/head.jsp" />
        <put-attribute name="left" value="/jsp/assets/left.jsp" />
    <put-attribute name="right" value="/jsp/assets/right.jsp" />
        <put-attribute name="body" />
    </definition>

    <definition name="showcardOverview" extends="base">
        <put-attribute name="body" value="/jsp/Showcard-Overview.jsp" />
    </definition>
</tiles-definitions>

SPRING VIEW CONFIG

<mvc:annotation-driven></mvc:annotation-driven>
<context:component-scan base-package="com.tms.zcore.movies.controller" />

<bean id="tilesviewResolver" class="org.springframework.web.servlet.view.tiles3.TilesViewResolver">
    <property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView"/>      
    <property name="order" value="1"/>
</bean>

<bean id="tilesConfigurer"
    class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
    <property name="definitions">
        <list>
            <value>/WEB-INF/conf/tiles/tiles-defs.xml</value>
        </list>
    </property>
</bean>

Edit:

Here is my Controller class

@Controller
@RequestMapping(value="/Showcard")
public class MovieShowcardController {

    @RequestMapping("/Overview/{id}/{seoName}")
    public String getMovieOverview(@PathVariable(value="id") String movieId, @PathVariable(value="seoName") String seoName, Model model) {
        return "showcardOverview";
    }
}
Slihp
  • 763
  • 5
  • 12
  • Are you sure the relative paths are correct: `/WEB-INF/conf/tiles/tiles-defs.xml` and `/jsp/Showcard-Overview.jsp` ? – Khanh Tran May 08 '13 at 19:09
  • Please show me a project directory if it's possbile. The reason may come from the path. – Khanh Tran May 08 '13 at 19:13
  • Hey. Yes the paths are correct. I've experimented by moving them in and out of the WEB-INF dir which always returns a 404. – Slihp May 08 '13 at 19:31

2 Answers2

1

Have you debugged inside TilesViewResolver/TilesView to see if the Tiles definition gets resolved correctly? A 404 implies that it does and that Tiles has forwarded to the JSP but failed. Does the same work with Tiles 2? I.e. is this a Tiles 3 related issue?

Rossen Stoyanchev
  • 4,910
  • 23
  • 26
  • I'm using the Spring TilesViewResolver & TilesView implementations so I cannot debug within them without the source. I have however swapped Tiles3 for the Tiles2 implementation and change my Spring config to match the changes. I'm still getting a 404 returned. – Slihp May 10 '13 at 17:55
  • So, downloading and attaching the tiles source I can see that when I enter the BasicTilesContainer the Definition object which is passed into the render method has the following properties. {name=showcardOverview, template=/WEB-INF/jsp/layouts/flagship.jsp, role=null, preparerInstance=null, attributes={body=/WEB-INF/jsp/Showcard-Overview.jsp, left=/WEB-INF/jsp/assets/left.jsp, head=/WEB-INF/jsp/assets/head.jsp, right=/WEB-INF/jsp/assets/right.jsp}} – Slihp May 10 '13 at 19:50
1

use full path of your jsp inside the tiles definition for example : instead of /jsp/layouts/flagship.jsp put /WEB-INF/jsp/layouts/flagship.jsp

BenMorel
  • 34,448
  • 50
  • 182
  • 322