0

我正在尝试将 Persual 访问添加到正常运行的应用程序

没有出现以下 URL 页面,我收到 http 400 错误请求。

http://localhost:9080/ASOPartners/perusal.do

使用以下网址,我得到

PageNotFound  W org.springframework.web.servlet.DispatcherServlet noHandlerFound No mapping found for HTTP request with URI [/ASOPartners/perusal/perusal.do] in DispatcherServlet with name 'asopartners'

http://localhost:9080/ASOPartners/perusal/perusal.do

这是我的新控制器方法的相关信息

@RequestMapping(value = "/perusal.do")
public String perusal(@RequestHeader(value = USERID_HEADER_KEY, required = false)   String userId,

@RequestHeader(value = COMPANYID_HEADER_KEY, required = false) String companyId,

@RequestHeader(value = "sm_serversessionId", required = false) String sessionId,

@RequestParam(value = USERID_PARAM_KEY, required = true) String appuserID,

@RequestParam(value = "companyId", required = true) String appcompID,

HttpServletRequest servletRequest,

WebRequest webRequest){

initializeUserSession(servletRequest);

这是我来自 Web.xml 的 servlet 映射

    <servlet>
    <description>Spring MVC Dispatcher Servlet</description>
    <servlet-name>asopartners</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>asopartners</servlet-name>
    <url-pattern>*.do</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>asopartners</servlet-name>
    <url-pattern>/asoclient</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>asopartners</servlet-name>
    <url-pattern>/asocustomer</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>asopartners</servlet-name>
    <url-pattern>/asooperations</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>asopartners</servlet-name>
    <url-pattern>/asooperations/addcompany</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>asopartners</servlet-name>
    <url-pattern>/asocustomer/usermaintenance</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>asopartners</servlet-name>
    <url-pattern>/asooperations/usermaintenance</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>asopartners</servlet-name>
    <url-pattern>/perusal</url-pattern>
</servlet-mapping>

这是我的视图控制器设置

    <!-- YOUR ENTRIES HERE -->
<context:component-scan base-package="com.wellsfargo.asopartners.common.db,
                                      com.wellsfargo.asopartners.factory,
                                      com.wellsfargo.asopartners.web,
                                      com.wellsfargo.asopartners.validator,
                                      com.wellsfargo.asopartners.dao">
</context:component-scan>

<!-- Configures the @Controller programming model -->
<mvc:annotation-driven />

<!-- Forwards requests to the "/" resource to the "welcome" view -->
<mvc:view-controller path="/perusal" view-name="redirect:perusal.do"/>
<mvc:view-controller path="/asocustomer" view-name="redirect:asocustomer/customer.do"/>
<mvc:view-controller path="/asocustomer/usermaintenance" view-name="redirect:usermaintenance/userMaintenance.do"/>
<mvc:view-controller path="/asoclient" view-name="redirect:asoclient/custClient.do"/>
<mvc:view-controller path="/asooperations" view-name="redirect:asooperations/operator.do"/>
<mvc:view-controller path="/asooperations/usermaintenance" view-name="redirect:usermaintenance/userMaintenance.do"/>
<mvc:view-controller path="/asooperations/addcompany" view-name="redirect:addcompany/addCompany.do"/>

我真的很厌倦自己试图解决这个问题。它的配置必须非常简单,我正在寻求专家的帮助。谢谢。

4

1 回答 1

0

使用第一个 URL:

http://localhost:9080/ASOPartners/perusal.do

问题是您没有将required @RequestParam属性作为 URL 的查询参数传递。它们被设置为required = true。因此400 Bad Request.

使用第二个 URL:

http://localhost:9080/ASOPartners/perusal/perusal.do

您的配置中没有任何映射来解析该 URL。也就是说,您的控制器方法绑定到/perusal.do,而不是/peruslal/perusal.do

于 2013-05-27T06:29:37.047 回答