这个问题已经有了答案here但是我已经检查了组件:扫描是为我设置的,所以我真的不明白这里有什么意义。控制器:
@Controller
@RequestMapping("view")
public class PortletController {
@RenderMapping
public String view(RenderRequest request, RenderResponse response, ModelMap model) {
ResourceURL baseResourceUrl = response.createResourceURL();
model.addAttribute("ajaxURL", baseResourceUrl.toString() + "&");
model.addAttribute("standalone", false);
model.addAttribute("portletId", getPortletId(request));
model.addAttribute("portletAppContextPath", request.getContextPath() + "/");
return "index";
}
applicationcontext中的组件扫描元素是:
<?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:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<!-- DispatcherPortlet Context: defines this portlet's request-processing infrastructure -->
<!-- Autodetect annotated controllers -->
<context:component-scan base-package="com.package.of.controller"/>
</beans>
知道为什么它不起作用?