Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring ViewResolver问题_Java_Spring Mvc - Fatal编程技术网

Java Spring ViewResolver问题

Java Spring ViewResolver问题,java,spring-mvc,Java,Spring Mvc,我的应用程序一直在成功运行,直到我在其中添加了org.springframework.web.servlet.view.InternalResourceViewResolver。它给出了错误: javax.servlet.ServletException:无法解析名为“cusbilman”的servlet中名为“/jsp/cusbilman/main/billportmain.jsp”的视图 我认为它打破了默认的重定向方法: 有什么想法吗 更新 守则: <bean id="htmlVie

我的应用程序一直在成功运行,直到我在其中添加了
org.springframework.web.servlet.view.InternalResourceViewResolver
。它给出了错误:

javax.servlet.ServletException:无法解析名为“cusbilman”的servlet中名为“/jsp/cusbilman/main/billportmain.jsp”的视图

我认为它打破了默认的重定向方法:

有什么想法吗


更新

守则:

<bean id="htmlViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/cusbilman/resources/static/"/>
        <property name="suffix" value=".html"/>
        <property name="viewNames">
            <list>
                <value>html1</value>
            </list>
        </property>
    </bean>

html1
旧bean定义:

<bean id="billingPortalMainController" class="com.tt.cusman.cusbilman.main.view.BillingPortalMainController" >
<property name="commandName"><value>dummy</value></property>            
<property name="commandClass"><value>com.tt.cusman.cusbilman.main.view.command.DummyObject</value></property>   
<property name="sessionForm"><value>false</value></property>
<property name="formView"><value>/jsp/cusbilman/main/billportmain.jsp</value></property>
<property name="successView"><value>/jsp/cusbilman/main/billportmain.jsp</value></property>
<property name="searchView"><value>/../cusinfman/search/search.html</value></property>
<property name="postPaidHome"><value>/cusbilman/cusbilman/invoices.html?page=new</value></property>
<property name="prePaidHome"><value>/cusbilman/cusbilman/prepaid/main.html?page=new</value></property>
<property name="emptyForm"><value>/cusbilman/jsp/cusbilman/main/emptyForm.jsp</value></property>
<property name="cusbilmanMainQdbDao" ref="cusbilmanMainQdbDao" />

笨蛋
com.tt.cusman.cusbilman.main.view.command.dummObject
假的
/jsp/cusbilman/main/billportmain.jsp
/jsp/cusbilman/main/billportmain.jsp
/../cusinfman/search/search.html
/cusbilman/cusbilman/invoices.html?页面=新建
/cusbilman/cusbilman/预付费/main.html?page=new
/cusbilman/jsp/cusbilman/main/emptyForm.jsp


感谢您的回复

视图解析器将把它自己的
前缀
后缀
属性与您从控制器返回的名称相结合

在这种情况下,它将使用

"/cusbilman/resources/static/" + "/jsp/cusbilman/main/billportmain.jsp" + ".html"
因此,将尝试在webapp基本目录中查找名为

/cusbilman/resources/static//jsp/cusbilman/main/billportmain.jsp.html
这在我看来是大错特错


您需要对视图解析器前缀和JSP路径进行排序。

post相关配置和代码否,它不会以这种方式处理,因为如果它以您的方式处理,错误消息将以这种方式给出:billportmain.JSP.html。我希望新的viewhandler关注url的如下内容:/cusbilman/resources/static/html1@Ali:不,那不是真的。您的“视图名称”仍然是
/jsp/cusbilman/main/billportmain.jsp
,这就是错误消息所指的内容。我告诉你你的设置有什么问题。如果你选择不相信它,这很公平。不要那么无礼,这只是一个想法。我想做的事情是,在不传递控制器的情况下调用html页面。我可以用一个简单的html href来实现,但是,它会造成安全问题,我不想触碰应用服务器属性等。