struts2整合jfreechart
需要的包:
struts2-jfreechart-plugin-2.2.1.1.jar
jfreechart-1.0.13.jar
jcommon-1.0.17.jar
前台jsp页面中可以使用iframe显示图表,代码
- <iframe id="frm1" name="frm1" src="/lzmgzyx/jfreechart.action" style="width:100%;height:700px"></iframe>
在struts.xml中配置,注意继承jfreechart-default,result的类型为chart

- <package name="/lzmgzyx" extends="struts-default,jfreechart-default"
- namespace="/lzmgzyx">
- <action name="jfreechart" class="com.demo.jfreechart.JfreechartAction">
- <result name="success" type="chart">
- <param name="height">650</param>
- <param name="width">1300</param>
- </result>
- </action>
- </package>

action中要有chart全局变量,提供get、set方法
- private JFreeChart chart;
前台提交请求后,aciton中的方法生成chart对象返回到前台就显示图表了。
action中方法例子

- public String execute()
- {
- DefaultCategoryDataset dataset = new DefaultCategoryDataset();
- dataset.addValue(15, "第一个比较项", "第一项");
- dataset.addValue(25, "第一个比较项", "第二项");
- chart = ChartFactory.createBarChart3D("标题", "横轴", "纵轴", dataset,PlotOrientation.VERTICAL, true, true, true);
- configFont(chart);
- return SUCCESS;
- }

生成的图表
struts2整合jfreechart的更多相关文章
- struts2整合JFreechart 饼图、折线图、柱形图
struts2整合JFreechart 饼图.折线图.柱形图 上效果图: 当然可以将数据导出图片格式存储.具体下的链接里的文件有保存成图片的操作. 因为是strust2整合JFreechart,所以s ...
- java项目中显示图表:struts2整合jfreechart
需要的包: struts2-jfreechart-plugin-2.2.1.1.jar jfreechart-1.0.13.jar jcommon-1.0.17.jar 前台jsp页面中可以使用ifr ...
- 投票系统开发总结struts2,jfreechart,cookie应用,以及前端技术
struts2配置web.xml+struts.xml: <?xml version="1.0" encoding="UTF-8"?> <we ...
- Spring与Struts2整合VS Spring与Spring MVC整合
Spring与Struts2整合,struts.xml在src目录下 1.在web.xml配置监听器 web.xml <!-- 配置Spring的用于初始化ApplicationContext的 ...
- struts2整合spring的思路
struts2整合spring有有两种策略: >sping容器负责管理控制器Action,并利用依赖注入为控制器注入业务逻辑组件. >利用spring的自动装配,Action将自动会从Sp ...
- struts2整合spring出现的Unable to instantiate Action异常
在struts2整合spring的时候,完全一步步按照官方文档上去做的,最后发现出现 Unable to instantiate Action,网上一搜发现很多人和我一样的问题,配置什么都没有错误,就 ...
- struts2整合json要注意的问题
昨天struts2整合json,一直出错: There is no Action mapped for namespace / and action name ... HTTP Status 404 ...
- struts2整合spring应用实例
我们知道struts1与spring整合是靠org.springframework.web.struts.DelegatingActionProxy来实现的,以下通过具体一个用户登录实现来说明stru ...
- Spring4笔记12--SSH整合3--Spring与Struts2整合
SSH 框架整合技术: 3. Spring与Struts2整合(对比SpringWeb): Spring 与 Struts2 整合的目的有两个: (1)在 Struts2 的 Action 中,即 V ...
随机推荐
- Spring Batch Framework– introduction chapter(下)
Extract,Transform, and load(ETL) Briefly stated, ETL is a process in the database anddata-warehousin ...
- Fastjson反序列化泛型类型时候的一个问题
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.u ...
- DTrace patch for Python 2.7.x and 3.x
DTrace patch for Python 2.7.x and 3.x Última Actualización: 21 de septiembre de 2015 https://www.jce ...
- careercup-递归和动态规划 9.2
9.2 设想有个机器人坐在X*Y网格的左上角,只能向右.向下移动.机器人从(0,0)到(X,Y)有多少种走法? 进阶: 假设有些点为“禁区”,机器人不能踏足.设计一种算法,找到一条路径,让机器人从左上 ...
- MVC - 身份验证
FormsAuthenticationTicket 使用此类来为用户生成一个身份票据 持有该票据则说明该用户是通过了身份验证的用户 可以随时访问某些资源 我们先创建几个类 //用户 public c ...
- 常用工具之stunnel
The stunnel program is designed to work as an SSL encryption wrapper between remote client and local ...
- selenium中定位iframe框
这是使用谷歌看到的源码.想要往里面输入内容,需要使用js. 这个iframe没有id,不能通过id直接定位到.但可以通用TagName来定位到iframe. WebDriver中定位的代码如下: St ...
- Ubuntu16.04/windows7修改本地hosts文件
1. 从github上下载最新的hosts文件:https://serve.netsh.org/pub/ipv4-hosts/ ubuntu16.04: 第二步:Ctrl+Alt+T 打开ubuntu ...
- 获取本地IP和端口号的指令
ipconfig就可以获取ip 获取端口号的指令: 开始--运行--cmd--输入netstat an(中间有一空格)
- Android开发之Intent的传值--Application
每当我们想要将输入的值传递到多个界面时,只是使用Intent传值的话,就会有一些的弊端. 下面我就以三个页面为例,进行简单的说明一下: 思路: 1.第一个页面是客户输入相关的信息. 2.将客户输入的信 ...