<mailto:em...@encs.concordia.ca>> wrote:
displaytag1.2 + struts2.2.1.1 + jfreechart.
<img src="jfreechartReport.action">
Can display graph, but when using displaytag to order by a
specific column , the graph does not refresh automatically.
Some clues?
> If the image is on the page why would it refresh unless the
page refreshes?
By clicking column "col1" - order action, struts2 triggered
"search() "method in JfreechartReport.java
Dataset is re-calculated and returned, but the graph is not!
This does not help diagnose the problem.
Is there a full-page refresh, or not?
I think so.
public class JfreechartReport extends ActionSupport
{
private BeanPageDisplay bean_display = new BeanPageDisplay();
private SqlSessionFactory sqlSessionFactory = null;
private ArrayList<BeanReportGraduation> alist_paging_bean = new
ArrayList<BeanReportGraduation>();
private JFreeChart chart;
private DefaultCategoryDataset dataset = new DefaultCategoryDataset();
...
/* when displaytag col1 is clicked, this method is called!
definitely, jsp page is refreshed!
*/
public String search() throws Exception
{
HttpServletRequest req=ServletActionContext.getRequest();
HttpServletResponse res=ServletActionContext.getResponse();
process_paging(req);
...
session.setAttribute("alist_paging_bean");
return SUCCESS;
}
public void process_paging ( HttpServletRequest req)
{
... to get & update alist_paging_bean used by .jsp displaytag
req.setAttribute("alist_paging_bean", this.alist_paging_bean);
req.setAttribute(GlobalGUI.DISPLAY_BEAN, this.bean_display);
}
public String jfreechart_report() throws Exception
{
HttpServletRequest req = ServletActionContext.getRequest();
HttpServletResponse res = ServletActionContext.getResponse();
this.alist_paging_bean =
(ArrayList<BeanReportGraduation>)session.getAttribute("alist_paging_bean");
setChart();
return SUCCESS;
}
public void setChart()
{
for(int i=0; i<alist_paging_bean.size(); i++)
{
...generate data set
}
chart = ChartFactory.createBarChart3D(
"example report",
"x",
"y",
dataset,
PlotOrientation.VERTICAL,
true,
true,
false
);
chart.setBackgroundPaint(java.awt.Color.white);
}
...
}
When click "col1", search() is called, and jfreechart_report() is called
as well, but the shared alist_paging_bean is not correctly displayed by
jfreechart!
--
Lu Ying
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org