无法导入AbstractXlsxVew

时间:2019-03-07 14:19:11

标签: spring spring-mvc apache-poi

我要进行Excel文件的下载过程。首先是pom:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>mg.telma</groupId>
    <artifactId>helios</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>helios Maven Webapp</name>
    <url>http://maven.apache.org</url>


    <properties>
        <java-version>1.8</java-version>
        <org.springframework-version>4.1.6.RELEASE</org.springframework-version>
        <org.spring-security-version>4.0.2.RELEASE</org.spring-security-version>
        <hibernate.version>4.3.5.Final</hibernate.version>
        <mysql.connector.version>5.1.31</mysql.connector.version>
        <hsqldb.version>2.3.2</hsqldb.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

        <!-- Servlet API -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/net.sf.supercsv/super-csv -->
        <dependency>
            <groupId>net.sf.supercsv</groupId>
            <artifactId>super-csv</artifactId>
            <version>2.4.0</version>
        </dependency>


        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>javax.servlet.jsp-api</artifactId>
            <version>2.3.1</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>org.apache.taglibs</groupId>
            <artifactId>taglibs-standard-impl</artifactId>
            <version>1.2.1</version>
        </dependency>

        <!-- spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <!-- for org.springframework.mail -->
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <!-- Spring Security -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${org.spring-security-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${org.spring-security-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${org.spring-security-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>${org.spring-security-version}</version>

        </dependency>

        <!-- spring ws -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
            <version>${org.spring-security-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.ws</groupId>
            <artifactId>spring-ws-core</artifactId>
            <version>2.4.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.commons.schema</groupId>
            <artifactId>XmlSchema</artifactId>
            <version>1.4.3</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-rt -->
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.2.7</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.sun.org.apache.xml.internal/resolver -->
        <dependency>
            <groupId>com.sun.org.apache.xml.internal</groupId>
            <artifactId>resolver</artifactId>
            <version>20050927</version>
        </dependency>

        <!-- fin spring ws -->
        <!-- displaytag -->
        <dependency>
            <groupId>displaytag</groupId>
            <artifactId>displaytag</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- <dependency> <groupId>displaytag</groupId> <artifactId>displaytag-export-poi</artifactId> 
            <version>1.1.1</version> </dependency> -->
        <!-- fin displaytag -->

        <!-- spring modules validation -->
        <dependency>
            <groupId>org.springmodules</groupId>
            <artifactId>spring-modules-validation</artifactId>
            <version>0.8</version>
            <exclusions>
                <exclusion>
                    <artifactId>spring</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <!-- MySQL -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.connector.version}</version>
        </dependency>

        <!-- HyperSQL DB -->
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>${hsqldb.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- MariaDB https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client -->
        <dependency>
            <groupId>org.mariadb.jdbc</groupId>
            <artifactId>mariadb-java-client</artifactId>
            <version>1.2.0</version>
        </dependency>

        <!-- commonss -->
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>

        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.3.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.3</version>
        </dependency>

        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3</version>
        </dependency>

        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>

        <!-- JSON -->
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
            <classifier>jdk15</classifier>
        </dependency>

        <!-- cglib-nodep -->
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib-nodep</artifactId>
            <version>2.2.2</version>
        </dependency>

        <!-- declare as provided or exclude from spring jars -->

        <!-- add slf4j interfaces to classpath -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.4</version>
            <scope>compile</scope>
        </dependency>

        <!-- add commons logging to slf4j bridge to classpath -->
        <!-- acts as jcl but routes commons-logging calls to slf4j -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>1.6.4</version>
            <scope>runtime</scope>
        </dependency>

        <!-- add log4j binding to classpath -->
        <!-- routes slf4j calls to log4j -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.4</version>
            <scope>runtime</scope>
        </dependency>

        <!-- AXIS -->
        <!-- https://mvnrepository.com/artifact/org.apache.axis/axis -->
        <dependency>
            <groupId>org.apache.axis</groupId>
            <artifactId>axis</artifactId>
            <version>1.4</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/axis/axis-jaxrpc -->
        <dependency>
            <groupId>axis</groupId>
            <artifactId>axis-jaxrpc</artifactId>
            <version>1.4</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.3.1</version>
        </dependency>

        <!-- Apache Commons IO -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>

        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>6.1.0</version>
        </dependency>

        <!-- Apache Commons POI -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.15</version>
        </dependency>
        <!-- compres image -->
        <dependency>
            <groupId>net.coobird</groupId>
            <artifactId>thumbnailator</artifactId>
            <version>0.4.7</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.itextpdf/itextpdf -->
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itextpdf</artifactId>
            <version>5.5.12</version>
        </dependency>
        <dependency>
            <groupId>org.olap4j</groupId>
            <artifactId>olap4j</artifactId>
            <version>1.2.0</version>
        </dependency>
        <!-- Java Mail API -->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.3</version>
        </dependency>
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.4.01</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

        </plugins>

        <finalName>helios</finalName>
        <!-- <sourceDirectory>src/main/java</sourceDirectory> <resources> <resource> 
            <directory>src/main/java</directory> <includes> <include>**/*.xml</include> 
            <include>**/*.properties</include> </includes> </resource> </resources> -->
    </build>
</project>

这是servlet.xml:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    classpath:org/springframework/beans/factory/xml/spring-beans-4.1.xsd
    http://www.springframework.org/schema/context
    classpath:org/springframework/context/config/spring-context-4.1.xsd
    http://www.springframework.org/schema/mvc
    classpath:org/springframework/web/servlet/config/spring-mvc-4.1.xsd
    http://www.springframework.org/schema/tx 
    classpath=org/springframework/transaction/config/spring-tx-4.1.xsd">

    <context:component-scan base-package="mg.telma.helios" />

    <mvc:annotation-driven />
    <mvc:resources mapping="/**/*.*" location="/"/>

    <bean class="org.springframework.web.servlet.view.XmlViewResolver">
        <property value="1" name="order"/>
        <property value="/WEB-INF/views.xml" name="location"/>
    </bean>

    <bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property value="2" name="order"/>
        <property name="prefix">
            <value>/pages/</value>
        </property>
        <property name="suffix">
            <value>.jsp</value>
        </property>
    </bean>
    <bean id="multipartResolver"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">

         <!-- setting maximum upload size -->
        <property name="maxUploadSize" value="104857600" />

    </bean>

</beans>

这是WEB-INF / views.xml:

<?xml version="1.0" encoding="UTF-8"?>

<beans xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans">

    <bean class="mg.telma.helios.csv.ExcelExportParcClient" id="excelExportParcClient"/>

</beans>

控制器:

@RequestMapping(value = "/reporting/exportexcelParcClient", method = RequestMethod.GET)
    public ModelAndView downloadCSVParcClient(HttpServletResponse response, HttpServletRequest request,
                                        @RequestParam(value = "deb") String sdate, @RequestParam(value = "statut") Integer statut, @RequestParam(value = "profil") Integer profil, @RequestParam(value = "site") Integer site) 
                                                throws IOException, Exception {

        String dateJour = CommonsDateformatUtils.frFormatDateHourText(new Date());
        String csvFileName = "Parc_Client" + dateJour + ".csv";

        DateFormat df = new SimpleDateFormat("dd/MM/yyyy", Locale.FRENCH);
        Date deb = df.parse(sdate);

        BeanSearchParcClient beanSearchParcClient = new BeanSearchParcClient();
        if (sdate != null && ! sdate.equals(""))
            beanSearchParcClient.setDateDebut(deb);
        if (statut != null)
            beanSearchParcClient.setStatut(statut);
        if (profil != null)
            beanSearchParcClient.setProfil(profil);
        if (site != null)
            beanSearchParcClient.setSite(site);

        List<EvolParc> evolutionParcs = new ArrayList<>();
        List<ParcClient> parcClients = new ArrayList<>();
        this.clientFOManager.getReportingParcClient(evolutionParcs, parcClients, beanSearchParcClient);

        ModelAndView modelView = new ModelAndView("excelExportParcClient");

        modelView.addObject("parcClients", parcClients);

        return modelView;

    }

excelExportParcClient的类:

public class ExcelExportParcClient extends AbstractXlsxView {


}

AbstractXlsxView类没有可用的导入建议!那我想念什么?

0 个答案:

没有答案