PDA

View Full Version : Need help immediately on jsp dashboard



magakamal
01-25-2007, 12:55 AM
i have found error as below,

Could not load data from test.xaction
Cannot generate the chart.

JSP FILE(mark.jsp):

<%@ page language="java"
import="java.util.ArrayList,
java.util.Date,
java.io.ByteArrayOutputStream,
org.pentaho.core.ui.SimpleUrlFactory,
org.pentaho.messages.Messages,
org.pentaho.core.system.PentahoSystem,
org.pentaho.ui.component.DashboardWidgetComponent,
org.pentaho.core.solution.HttpRequestParameterProvider,
org.pentaho.core.solution.HttpSessionParameterProvider,
org.pentaho.core.session.IPentahoSession,
org.pentaho.core.util.UIUtil,
org.pentaho.util.VersionHelper,
org.pentaho.messages.util.LocaleHelper,
org.pentaho.core.solution.ActionResource,
org.pentaho.core.solution.IActionResource,
org.pentaho.core.solution.SimpleParameterProvider,
org.pentaho.ui.ChartHelper,
java.io.*"

<html>
<head>
<title>Student Reporting- JSP</title>
</head>
<body>



<h1 style='font-family:Arial'><%= title %></h1>

<table>
<tr>
<td valign="top"><span style="font-family:Arial;font-weight:bold">Select a Region By Clicking on the Pie Chart</span>

<%
// Make a pie chart showing the regions
// create the parameres for the pie chart
SimpleParameterProvider parameters = new SimpleParameterProvider();
// define the click url template
parameters.setParameter( "drill-url", "mark.jsp?region={SSLC}" );
// define the slices of the pie chart
parameters.setParameter( "inner-param", "SSLC"); //$NON-NLS-1$ //$NON-NLS-2$
// set the width and the height
parameters.setParameter( "image-width", "200"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter( "image-height", "300"); //$NON-NLS-1$ //$NON-NLS-2$
StringBuffer content = new StringBuffer();
ArrayList messages = new ArrayList();
// call the chart helper to generate the pie chart image and to get the HTML content
// use the chart definition in 'samples/dashboard/regions.widget.xml'
out.write("Hellooooooooooooo");
ChartHelper.doPieChart( "samples", "dashboard", "student.widget.xml", parameters, content, userSession, messages, null );
%>

<%= content.toString() %>
<% out.write("Hello"); %>
</td>

</tr>
</table>

</body>
</html>



test.xaction:

<query><![CDATA[select DEPT, sum(SSLC) as SSLC
from personaldetails
group by DEPT
order by SSLC]]></query>

..............
<connection><![CDATA[jdbc:mysql://127.0.0.1/student]]></connection>
<driver><![CDATA[com.mysql.jdbc.Driver]]></driver>
<user-id><![CDATA[root]]></user-id>


student.widget.xml

- <chart>
- <!-- This file defines the pie chart that shows the actual values for each region
-->
<chart-type>PieChart</chart-type>
- <!-- Specify the title of the chart
-->
<title>Headcount Spending by Region</title>
- <!-- Specify the location of the title
-->
<title-position>top</title-position>
- <!-- Specify the font of the title
-->
- <title-font>
<font-family>Ariel</font-family>
<size>20</size>
<is-bold>false</is-bold>
<is-italic>false</is-italic>
</title-font>
<width>450</width>
<height>300</height>
- <!-- Specify the 3D-ness of the bars
-->
<is-3D>false</is-3D>
- <!-- Specify if the chart has a border and the border color
-->
<border-visible>true</border-visible>
- <!-- Specify is the chart legend should be shown
-->
<include-legend>false</include-legend>
- <!-- Specify where the data for the chart comes from
-->
- <data>
- <!-- Specify the path to the action sequence that provides the data
-->
<data-solution>samples</data-solution>
<data-path>dashboard</data-path>
<data-action>test.xaction</data-action>
- <!-- Specify the output of the action sequence that contains the data
-->
<data-output>rule-result</data-output>
<data-name>DEPT</data-name>
<data-value>SSLC</data-value>
- <!-- Specify whether to get the pie series from the rows or columns
-->
<data-orientation>columns</data-orientation>
</data>
</chart>



The pie chart generate dependence DEPT.so where did the mistake take place.
Please help me. and also my database connection is right or wrong?

guser
01-25-2007, 08:35 AM
have you specified xaction output.
look for this. in xaction.

<action-outputs>
<query-result type="result-set" mapping="rule-result"/>
<DEPT type="string"/>
<SSLC type="string"/>
</action-outputs>