http://blog.csdn.net/evangel_z/article/details/29585571
过程参照以上博客,不过有一些与其中不同的地方。本文仅仅补充上面博客内容的不足。
1.下载IDEA,并且新建一个Web Project
我使用的IDEA版本是14.1.3,可能不同的版本创建Web Project的步骤不同,可以根据自己的版本去百度。这里需要注意的是IDEA新建的Web Project可能与eclipse中的Web Project的目录有点点不同,没有WebRoot或者WebContent是正常的。eclipse好像可以直接添加jpivot支持。但是IDEA需要下载额外的jar包
链接:https://pan.baidu.com/s/1gfTRzzX 密码:5dq5
我找不到原地址了。将这个5个包放到lib文件夹下就好了。
2.下载Mondrian的压缩包
Mondrian3.5的下载地址:https://nchc.dl.sourceforge.net/project/mondrian/mondrian/mondrian-3.5.0/mondrian-3.5.0.zip。
3.将压缩包中需要的部分加入到Web Project
1)进入到上图中的lib文件夹,找到mondrian.war
2)将mondrian.war解压,如下图
3)将圈中的文件复制到Web目录下,进入上图的WEB-INF文件夹,用里面web.xml替换你的工程的Web->WEB-INF的web.xml
4.下载jpivot的压缩包
下载地址:http://dl.download.csdn.net/down10/20111122/548f260dc8568245b1746d064f04155c.zip?response-content-disposition=attachment%3Bfilename%2A%3D%22utf8%27%27jpivot-1.8.0.zip%22&OSSAccessKeyId=9q6nvzoJGowBj4q1&Expires=1516177448&Signature=M%2BdOX76YhNt0Ppz%2BtRTZqF2xr1Q%3D&user=wkd_ywf&sourceid=3827309&sourcescore=3&isvip=0
这个是我登陆CSDN账号下载的,如果不使用这个里面的文件,将会导致servlet请求404页面的出现。
1)找到jpivot.war并解压
2)将下图圈中的文件复制到你的项目的WEB-INF中
5.数据库准备
因为我一直使用的是mysql数据库,这个例子我是用的也是Mysql数据库
1)JDBC driver下载
https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.45.zip
2)IDEA引入jar,参考下面博客,很详细
http://blog.csdn.net/a153375250/article/details/50851049
引入之后不要忘记把这个jar文件复制到lib文件夹下
3)添加测试数据
- /**销售表*/
- create table Sale (
- saleId int not null,
- proId int null,
- cusId int null,
- unitPrice float null, --单价
- number int null, --数量
- constraint PK_SALE primary key (saleId)
- ) ;
- /**用户表*/
- create table Customer (
- cusId int not null,
- gender char(1) null, --性别
- constraint PK_CUSTOMER primary key (cusId)
- ) ;
- /**产品表*/
- create table Product (
- proId int not null,
- proTypeId int null,
- proName varchar(32) null,
- constraint PK_PRODUCT primary key (proId)
- ) ;
- /**产品类别表*/
- create table ProductType (
- proTypeId int not null,
- proTypeName varchar(32) null,
- constraint PK_PRODUCTTYPE primary key (proTypeId)
- ) ;
如果上面语句直接复制到数据库命令行出错,那就去掉注释部分。
- insert into Customer(cusId,gender) values(1,'F')
- insert into Customer(cusId,gender) values(2,'M')
- insert into Customer(cusId,gender) values(3,'M')
- insert into Customer(