我正在为我的项目使用 Spring MVC 框架。
我无法让我的代码从控制器运行到查看。
在这里分享重要的代码块.....
AdminController.java 控制器内部
System.out.println("controller returning");
return new ModelAndView("dataFrame_","frameData",dataString);
里面dispatcher-servlet.xml
<bean name="/dataFrame.htm"
class="com.organization.dept.spec.proj.module.controller.DataFrameController" >
</bean>
<bean id="dataFrameViewResolver"
class="com.organization.dept.spec.proj.module.view.DataFrameViewResolver">
<property name="dataFrameView">
<bean class="com.organization.dept.spec.proj.module.view.DataFrameView" />
</property>
<property name="dataFramePrefix" value="dataFrame_"></property>
</bean>
在 DataFrameViewResolver.java 里面
public class DataFrameViewResolver extends AbstractCachingViewResolver {
private String dataFramePrefix;
private View dataFrameView;
@Override
protected View loadView (String viewName, Locale locale) throws Exception {
View view = null;
if(viewName.startsWith(this.dataFramePrefix)){
view = dataFrameView;
}
return view;
}
和
public String getDataFramePrefix() {
return dataFramePrefix;
}
public void setDataFramePrefix(String dataFramePrefix) {
this.dataFramePrefix = dataFramePrefix;
}
public View getDataFrameView() {
return dataFrameView;
}
public void setDataFrameView(View dataFrameView) {
this.dataFrameView = dataFrameView;
}
}
在 DataFrameView.java ...
public class DataFrameView extends AbstractView {
@Override
protected void renderMergedOutputModel(Map map, HttpServletRequest request,HttpServletResponse response) throws Exception {
System.out.println("RenderMergeoutputModel"); //line 99
我无法获得上述 system.out.println 即无法执行我的代码直到第 99 行。tomcat
的 localhost 日志文件显示了一些异常java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.Config
,我将 jstl-1.2.jar 放在 lib 中,这可以让我摆脱但是仍然无法获取第 99 行的 DataFrameView 的 sysout。