Ciao a tutti,
la mia applicazione web sviluppata con Java, WebLogic 10.3.5, Spring 3.1 e Jasper 5.0.1 mi sta dando problemi in fase di export di un file excel.
Di seguito alcuni frammenti di codice:
Pagina JSP:
codice HTML:
<a title="Export" href="javascript:window.location.replace('<%=path %>/admin/export.com');">Export</a>
Spring MVC Controller:
codice:
@RequestMapping("/export.com")
public ModelAndView exportAction(@ModelAttribute("model") UserModel model, HttpServletRequest request) throws Exception{
SearchBean searchForm = model.getSearchForm();
Map<String,Object> parameterMap = new HashMap<String,Object>();
List<User>usersList = iReportService.getUsers(searchForm,null).getResults();
JRDataSource JRdataSource = new JRBeanCollectionDataSource(usersList);
parameterMap.put("datasource", JRdataSource);
return new ModelAndView("XlsUserReport",parameterMap);
}
pom.xml
codice:
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.0.1</version>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.6</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
fe-servlet.xml
codice:
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.tiles2.TilesView</value>
<property name="order" value="1"/>
</property>
</bean>
<bean class="org.springframework.web.servlet.view.XmlViewResolver">
<property name="location" value="/WEB-INF/report.xml"/>
<property name="order" value="0"/>
</bean>
report.xml
codice:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="XlsUserReport"
class="org.springframework.web.servlet.view.jasperreports.JasperReportsXlsView"
p:url="classpath:report/report/user.jrxml"
p:reportDataKey="datasource">
<property name="headers">
<props>
<prop key="Content-Disposition">
attachment; filename=users.xls
</prop>
</props>
</property>
</bean>
</beans>
Il tutto funziona sotto Tomcat. Deployata l'aplpicazione in WebLogic, però, al click sul tasto 'Esporta' non compare la finestra di download
ma compare una pagina bianca che risponde all'indirizzo .../export.com.
Quale può essere i problema?
Grazie