user3631087
user3631087

Reputation: 1

Spring MVC 3 + Tiles 2 404 error. The requested resource is not available

My tiles config file

<definition name="loginlayout" template="WEB-INF/layouts/login-layout.jsp">
    <put-attribute name="title" value="" />
    <put-attribute name="header"
        value="/WEB-INF/views/tiles/login-header.jsp" />
    <put-attribute name="body" value="" />
    <put-attribute name="footer"
        value="/WEB-INF/views/tiles/login-footer.jsp" />
</definition>

<definition name="login" extends="loginlayout">
    <put-attribute name="body" value="/WEB-INF/views/login.jsp" />
</definition>

Controller method

@RequestMapping(value = "/user/login", method = RequestMethod.GET)
    public ModelAndView login() {
        return new ModelAndView("login", "asiUser", new AsiUser());
    }

spring config xml

<bean id="viewResolver"
    class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass">
        <value>
            org.springframework.web.servlet.view.tiles2.TilesView
        </value>
    </property>
</bean>

<bean id="tilesConfigurer"
    class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
    <property name="definitions">
        <list>
            <value>/WEB-INF/views/tiles/tiles.xml</value>
            <value>/WEB-INF/views/tiles/tilesdr.xml</value>
                <value>/WEB-INF/views/tiles/tilesone.xml</value>
        </list>
    </property>
</bean>

This runs perfectly if i remove the '/user/' url part from the controller. But if i run with it, it throws the "The requested resource (/ast_intranet_v1/user/WEB-INF/layouts/login-layout.jsp) is not available"

Please help me with this. Am I missing some basics?

Upvotes: 0

Views: 846

Answers (1)

Stefan
Stefan

Reputation: 12462

You are missing a slash in front of WEB-INF:

 <definition name="loginlayout" template="/WEB-INF/layouts/login-layout.jsp">

That would make the path relative to your current url.

Upvotes: 3

Related Questions