Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Has anyone used cewolf?

843836Jun 9 2005 — edited Feb 7 2007
Hello, I m new to cewolf, I just managed to produce a basic pie chart. I using a sql query to generate the piechart, which I have done so and displayed it in a webpage. what I problem with is I need to send some daynamic data into my query, I have no idea how to that from cewolf tag lib.

This what I so far:

jsp file.
<jsp:useBean id="pieChartView" class="de.laures.cewolf.example.FaultsByCampus"/>
<cewolf:chart id="pieExample3D" type="pie3D" title="Faults By Campus"
   showlegend="flase">
<cewolf:data>
 <cewolf:producer id="pieChartView" />
</cewolf:data>
<cewolf:colorpaint color="#EEEEEF"/>
</cewolf:chart>
<cewolf:img chartid="pieExample3D" renderer="/cewolf" border="0" width="700" height="400">
<cewolf:map tooltipgeneratorid="pieChartViewToolTips"/>
</cewolf:img>
this is my query in the bean class, this the priduceDataset method. I want to replace those hard coded dates in the my query with ones from the request parameter. any ideas how that can be done.
 public Object produceDataset(Map params) throws DatasetProduceException {
    	log.debug("producing data.");
        DefaultPieDataset  dataset = new DefaultPieDataset (){
			/**
			 * @see java.lang.Object#finalize()
			 */
			protected void finalize() throws Throwable {
				super.finalize();
				log.debug(this +" finalized.");
			}
        };

		Connection con = getDBConnection(); //Gets database connection.
		java.sql.PreparedStatement pstmt = null; //Create an instance of PreparedStatement.
		 
		try{

			String query = "SELECT COUNT(FAULTID), SITE FROM FAULTS WHERE DATE_LOGGED>= to_date('01/feb/2005','dd/MON/yyyy') " +
						   "AND DATE_LOGGED<= to_date('28/feb/2005','dd/MON/yyyy') AND FIXED_DATE IS NOT NULL AND SITE is not null GROUP BY SITE";
			pstmt = con.prepareStatement(query);
			ResultSet rs = pstmt.executeQuery();

			while(rs.next()) {
                 dataset.setValue(rs.getString(2),new Integer(rs.getInt(1)));
            }

			rs.close();
			pstmt.close(); 

		}catch (Exception ex) {
                //throw new RuntimeException(se);
				ex.printStackTrace();
        }finally {
            try{
                con.close();
            } catch (Exception ex) {
            }
        }
		  
        return dataset;
    }
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 7 2007
Added on Jun 9 2005
1 comment
162 views