查看弹簧MVC的解析器无法正常工作

时间:2015-08-05 13:07:02

标签: java spring spring-mvc struts2

我们的应用程序使用带弹簧的支柱。所有bean都由spring容器和struts调用的动作启动。我想并行实现spring的MVC。 的的web.xml

    <filter> 
            <filter-name>struts2</filter-name>
            <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
            <init-param>
                <param-name>actionPackages</param-name>
                <param-value>com.nucleus.finnone.prototype</param-value>
            </init-param>
        </filter>
        <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

<servlet>
        <servlet-name>spring</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/springmvc-context.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
      <servlet-name>spring</servlet-name>
        <url-pattern>/reportmanager/showReport/true</url-pattern>
    </servlet-mapping>

用SpringMVC-context.xml中

 <bean id="viewResolver"
          class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
              <property name="prefix">
                 <value>/WEB-INF/pages/</value>
              </property>
              <property name="suffix">
                 <value>.jsp</value>
              </property>
        </bean>

struts.xml中

<constant name="struts.action.excludePattern" value="/reportmanager/showReport/true"/>

CONTROLLER

@Controller
@RequestMapping({"/reportmanager"})
public class ReportController
{

    @RequestMapping(value={"/showReport/{generateReportFlag}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
      public ModelAndView showReport(ModelMap modelMap, @PathVariable boolean generateReportFlag) { 
        String message = "Hello World, Spring 3.0!";
        return new ModelAndView("ShowRegisteredReport", "message", message);
      }
}

JSP

<html>
<head>
    <title>Spring 3.0 MVC Series: Hello World</title>
</head>
<body>
    ${message}
</body>
</html>

我遇到了控制器,但得到了我的观点:{“view”:null,“model”:{},“empty”:false,“reference”:true,“viewName”:“showRegisteredReport”, “modelMap”:{}}

0 个答案:

没有答案