我正在尝试创建一个简单的视图解析器,无论您想要什么视图(作为起点),它都会返回hello world.
到目前为止我有这个:
public class MyViewResolver extends AbstractTemplateView {
@Override
protected void renderMergedTemplateModel(Map
现在我收到此错误:
2012-03-29 16:51:28.855:WARN:/:unavailable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'viewResolver' defined in ServletContext resource [/WEB-INF/application-context.xml]: Invocation of init method Failed; nested exception is java.lang.IllegalArgumentException: Property 'url' is required
at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.initializeBean(AbstractAutowireCapablebeanfactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.doCreateBean(AbstractAutowireCapablebeanfactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.createBean(AbstractAutowireCapablebeanfactory.java:456)
at org.springframework.beans.factory.support.Abstractbeanfactory$1.getObject(Abstractbeanfactory.java:294)
我已经实现了所需的AbstractTemplateView,不确定它要求的url属性是什么?
此外,传递给此viewresolver的视图的名称在哪里?
更新
所以我补充说:
@Override
public boolean isUrlrequired() {
return false;
}
而现在我只是得到一个错误:
HTTP ERROR 404
Problem accessing /home/index. Reason:
NOT_FOUND
我的application-context.xml有:
我错过了什么?
最佳答案
原文链接:https://www.f2er.com/spring/431786.html