To display and map a JSP from the WEB-INF folder, you must declare a ViewResolver.
For example:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" p:order="1"/>
</beans>
Take note, there are different resolvers you can use depending on your needs.
Assuming you have a URL /welcome and you want to map it to WEB-INF/jsp/welcome.jsp, your controller must have the following signature:
Code:
@Controller
@RequestMapping("/")
public class MediatorController {
@RequestMapping("/welcome")
public String getPage() {
return "welcome";
}
}
Of course, I have purposely remove some configuration files in this example.