Spring ViewResolver问题
我的应用程序一直成功运行,直到我在其中添加 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>
旧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" />
感谢您的回复
My application was running succestfully until I add a org.springframework.web.servlet.view.InternalResourceViewResolver
in it. It gives the error:
javax.servlet.ServletException: Could not resolve view with name '/jsp/cusbilman/main/billportmain.jsp' in servlet with name 'cusbilman'
I think it broke the default redirection method:
Any ideas?
Update
The code:
<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>
Old bean definition:
<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" />
Thanks for the reply
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
视图解析器会将其自己的
prefix
和suffix
属性与您从控制器返回的名称结合起来。在这种情况下,它将使用
并因此尝试在 webapp 基本目录中查找名为的文件,
该文件对我来说看起来严重错误。
您需要整理视图解析器前缀和 JSP 路径。
The view resolver will combine it's own
prefix
andsuffix
properties with the name you return from your controller.In this case, it will use
and will therefore try and look for a file inside the webapp base directory named
which looks seriously wrong to me.
You need to sort out your view resolver prefix and JSP paths.