Mahmoud Saleh
Mahmoud Saleh

Reputation: 33605

InternalResourceViewResolver doesn't load page from subfolder

under the webapp folder of my application i have a folder called meetingroom and in that folder i have a jsp page called viewrooms.jsp

- DispatcherServlet configuration is as follows:

<listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<context-param>
    <param-name>contextConfigLocation</param-name>
        <param-value>
         classpath:spring/config/applicationContext.xml
    </param-value>
</context-param>


<servlet>  
    <servlet-name>spring</servlet-name>  
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>    
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring/config/applicationContext.xml</param-value>
   </init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>  
    <servlet-name>spring</servlet-name>  
    <url-pattern>/meetingroom/*</url-pattern>  
</servlet-mapping>

- InternalResourceViewResolver bean:

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/"/>
    <property name="suffix" value=".jsp"/>
</bean>

- Controller:

@Controller
@RequestMapping("/viewrooms.jsp")
public class ViewRooms {



    @RequestMapping(method = RequestMethod.GET)
    public String get() {
        log.debug("######## GET METHOD FOR VIEW ROOMS ########");
        return "meetingroom/viewrooms";
    }
}

ISSUE: the controller get method is getting called in infinite loop and the page is not rendered.

please advise why it's not working, thanks.

Upvotes: 0

Views: 1382

Answers (2)

wmax
wmax

Reputation: 1064

IMHO @RequestMapping("/viewrooms.jsp") points to /MyAPP/viewrooms.jsp changing @RequestMapping to "/meetingroom/viewrooms.jsp" would be my next guess for the fix of your problem

Upvotes: 1

Mahmoud Saleh
Mahmoud Saleh

Reputation: 33605

problem fixed after changing the pages folder name, maybe it was conflicting with the servlet url mapping.

Upvotes: 0

Related Questions