Java 带JExcelAPI的spring3(注释)
我尝试使用Spring3和注释来完成本教程 所以我有一个WebAppConfig类Java 带JExcelAPI的spring3(注释),java,spring,excel,annotations,jexcelapi,Java,Spring,Excel,Annotations,Jexcelapi,我尝试使用Spring3和注释来完成本教程 所以我有一个WebAppConfig类 @Configuration @ComponentScan("com.mkyong.common") @EnableWebMvc public class WebAppConfig { @Bean public InternalResourceViewResolver setupViewResolver() { InternalResourceViewResolver resolver = new
@Configuration
@ComponentScan("com.mkyong.common")
@EnableWebMvc
public class WebAppConfig {
@Bean
public InternalResourceViewResolver setupViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/pages/");
resolver.setSuffix(".jsp");
return resolver;
}
}
和WebAppInitializer类
class public class WebAppInitializer implements WebApplicationInitializer {
public void onStartup(ServletContext servletContext) throws ServletException {
XmlWebApplicationContext appContext = new XmlWebApplicationContext();
String[] locations = { "classpath*:applicationContext.xml" };
appContext.setConfigLocations(locations);
ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(appContext));
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping("/");
servletContext.addListener(new ContextLoaderListener(appContext));
servletContext.getServletRegistration ("default").addMapping ("*.js", "*.css", "*.jpg", "*.gif", "*.png");
}
}
我对经典页面(没有excel)没有任何问题,但对于excel,应用程序会查找ExcelRevenueSummary.jsp
有人知道我如何“翻译”这个吗:
以Spring 3使用的正确格式
谢谢。首先,您的
WebAppConfig
尚未在任何地方注册。您是对的。我该怎么做?我的配置现在调用得很好。我已经输入了applicationContext.xml。除了带有视图的excel部分外,其他一切都正常工作。
<bean id="ExcelRevenueSummary"
class="com.mkyong.common.view.ExcelRevenueReportView">
</bean>