Bonjour, je suis en stage dans une entreprise qui veut que je crée un affichage graphique avec CEWOLF.
J'utilise pour ça un formulaire HTML qui me permet de récupérer les paramètres de tri dont j'ai besoin.
J'ai essayé de récupérer des valeurs de mon formulaire à l'aide de req.getParameterValues, mais j'obtient un javaNullPointer au chargement de Graphes.jsp


Graphes;JSP:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
 
<div id="menu">
	<font color=#FF6600 size=4><b>Choix de la période de sélection </b></font>
	<div class="dec">
		<a href="Accueil.html">Lien vers le mode d'emploi</a>
	</div>	
	<hr>
	<form name="selecperiode" >
		<INPUT type="radio" name="periode" value=0 "> <b>Par mois</b><BR>
			<div class="dec">
				Mois:
				<SELECT name="selectionmois">
					<OPTION VALUE="01">Janvier</OPTION>
					<OPTION VALUE="02">Février</OPTION>
					<OPTION VALUE="03">Mars</OPTION>
					<OPTION VALUE="04">Avril</OPTION>
					<OPTION VALUE="05">Mai</OPTION>
					<OPTION VALUE="06">Juin</OPTION>
					<OPTION VALUE="07">Juillet</OPTION>
					<OPTION VALUE="08">Août</OPTION>
					<OPTION VALUE="09">Septembre</OPTION>
					<OPTION VALUE="10">Octobre</OPTION>
					<OPTION VALUE="11">Novembre</OPTION>
					<OPTION VALUE="12">Décembre</OPTION>	
				</SELECT>
			</div>
			<div class="dec">
				Année:
				<SELECT name="selectannee">
					<OPTION VALUE="01">2008</OPTION>
					<OPTION VALUE="02">2009</OPTION>
					<OPTION VALUE="03">2010</OPTION>
					<OPTION VALUE="04">2011</OPTION>
				</SELECT>
			</div>
			<hr>
 
		<INPUT type="radio" name="periode" value=1 "> <b>Par semaine</b><BR>
			<div class="dec">
				Semaine:
				<SELECT name="selectsemaine">
					<%	for (int i=1;i<53;i++)
						{
							out.println("Semaine:  <OPTION VALUE="+i+">"+i+"</OPTION>");	
						}%>
				</SELECT><br>
				</div>
			<div class="dec">
				Année:
				<SELECT name="selectannee" >
					<OPTION VALUE="01">2008</OPTION>
					<OPTION VALUE="02">2009</OPTION>
					<OPTION VALUE="03">2010</OPTION>
					<OPTION VALUE="04">2011</OPTION>
				</SELECT>
			</div><hr>
 
		<INPUT type="radio" name="periode" value=2 "> <b>Par jour</b><BR>
 
			<div class="dec">
				Jour:
				<SELECT name="selectjour">
					<%	for (int j=1;j<31;j++)
						{
							out.println("<OPTION VALUE="+j+">"+j+"</OPTION>");	
						} %>
				 </SELECT>
			</div>
			<div class="dec">
				Mois:
				<SELECT name="selectionmois">
					<OPTION VALUE="01">Janvier</OPTION>
					<OPTION VALUE="02">Février</OPTION>
					<OPTION VALUE="03">Mars</OPTION>
					<OPTION VALUE="04">Avril</OPTION>
					<OPTION VALUE="05">Mai</OPTION>
					<OPTION VALUE="06">Juin</OPTION>
					<OPTION VALUE="07">Juillet</OPTION>
					<OPTION VALUE="08">Août</OPTION>
					<OPTION VALUE="09">Septembre</OPTION>
					<OPTION VALUE="10">Octobre</OPTION>
					<OPTION VALUE="11">Novembre</OPTION>
					<OPTION VALUE="12">Décembre</OPTION>	
				</SELECT>
			</div>
			<div class="dec">
				Année:
				<SELECT name="selectannee">
					<OPTION VALUE="01">2008</OPTION>
					<OPTION VALUE="02">2009</OPTION>
					<OPTION VALUE="03">2010</OPTION>
					<OPTION VALUE="04">2011</OPTION>
				</SELECT>
			</div><hr>
 
			<b>Base de cas:</b>	<br>
			<div class="dec">
				<input type="checkbox" name="CB" value="1" checked="checked">Home<br>
				<input type="checkbox" name="CB" value="2">OEE<br>
				<input type="checkbox" name="CB" value="3">Chorus<br>
				<input type="checkbox" name="CB" value="5">Personal (OEE + Chorus)<br>
				<input type="checkbox" name="CB" value="4">TA<br>
			</div>
 
			<b>Statut:</b><br>
			<div class="dec">
 
				<input type="checkbox" name="Statut" value="0" checked="checked">En cours<br>
				<input type="checkbox" name="Statut" value="1">Bookmark<br>
				<input type="checkbox" name="Statut" value="2">Fermé<br>
				<input type="checkbox" name="Statut" value="3">Abandon<br>
				<input type="checkbox" name="Statut" value="5">Tous<br>
			</div>
			<b>Profil:</b>	<br>
			<div class="dec">
				<input type="radio" name="Profil" value="0" checked="checked">Prod<br>
				<input type="radio" name="Profil" value="1">Test<br>
				<br>
				<input type="submit" value="Afficher">
			</div>
	</form>
</div>
 
<div id="contenu">
	<jsp:useBean id="pageViews" class="com.cewolf.CountData"/>
	<cewolf:chart 
	    id="stackedVerticalBar" 
	    title="Statistiques d'utilisation" 
	    type="stackedVerticalBar" 
	    xaxislabel="" 
	    yaxislabel="Nombre de sessions">
 
	    <cewolf:data>
	        <cewolf:producer id="pageViews"/>
	    </cewolf:data>
 
	</cewolf:chart>
 
	<p>
 
	<cewolf:img chartid="stackedVerticalBar" renderer="cewolf" width="1000" height="650"/>
</div>
CountData.java:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
 
 
import java.io.IOException;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;
 
import com.database.ConnectionManager;
 
import de.laures.cewolf.DatasetProduceException;
import de.laures.cewolf.DatasetProducer;
import de.laures.cewolf.links.CategoryItemLinkGenerator;
import de.laures.cewolf.tooltips.CategoryToolTipGenerator;
 
 
 
 
@SuppressWarnings("serial")
public class CountData implements DatasetProducer, CategoryToolTipGenerator, CategoryItemLinkGenerator, Serializable 
{
 
	HttpServletRequest req;
	HttpServletResponse res;
 
	private static final Log log = LogFactory.getLog(CountData.class);
	private final String[] CB = {"1", "2", "3", "4"};
	String[] seriesNames = (req.getParameterValues("Statut"));
	@SuppressWarnings("serial")
 
 
 
 
 
 
 
	public Object produceDataset(Map params) throws DatasetProduceException 
	{
		System.out.println(seriesNames);
 
		log.debug("producing data.");
		DefaultCategoryDataset dataset = new DefaultCategoryDataset()
		{
			protected void finalize() throws Throwable {
				super.finalize();
				//log.debug(this +" finalized.");
			}
		};
 
		String maxDate ;
		Connection con = ConnectionManager.getConnection();
		PreparedStatement pstmt1 = null;
		PreparedStatement pstmtDate = null;
		if (con != null)
		{
			try
			{				
				int i =0;
				SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyyMMdd");
				java.util.Date startDate = dateFormatter.parse("20090611");
				//java.util.Date endDate = dateFormatter.parse("20090614");
				String req = "SELECT SUM(Valeur), Id_TH, Id_CB FROM donnees_connections WHERE Date = ? AND (";
 
				while(i < seriesNames.length)
				{ 
					if(!seriesNames[i].equals(""))
					{
						req=req+" Id_Statut = "+seriesNames[i];
						i++;
 
						if(i == seriesNames.length)
						{
							req=req+")";
						}
						else
						{
							req=req+" OR";
						}
					}
				}
 
				i=0;
				req =req+"AND (";
				while(i < CB.length)
				{ 
					req=req+" Id_CB = "+CB[i];
					i++;
 
					if(i == CB.length)
					{
						req=req+")";
					}
					else
					{
						req=req+" OR";
					}
				}
				req= req+" GROUP BY Id_CB,Id_TH";
 
				System.out.println(req);
				//préparation de la requête
				pstmt1 = con.prepareStatement(req);
				pstmt1.setDate(1,new java.sql.Date(startDate.getTime()));
				//pstmt1.setDate(2,new java.sql.Date(endDate.getTime()));
				ResultSet rs = pstmt1.executeQuery();
 
				int nb_sessions=0;
				String HourName;
				String CBiD;
				while (rs.next())
				{			
					nb_sessions=rs.getInt(1);
					HourName=rs.getString(2);
					CBiD=rs.getString(3);
					System.out.println("Sessions :"+ nb_sessions +", Base Cas :"+ CBiD+", Hour :"+ HourName);
					dataset.addValue( nb_sessions, "CBR"+CBiD,  HourName);	
				}
 
				pstmtDate = con.prepareStatement("SELECT MAX(Date) FROM donnees_connections");
				ResultSet rsDate = pstmtDate.executeQuery();
 
				while (rsDate.next())
				{			
					maxDate=rsDate.getString(1);
					System.out.println("Dernière mise à jour:"+ maxDate);	
				}
 
			}
			catch(SQLException sqlex)
			{
				sqlex.printStackTrace();
			}
			catch(ParseException pex)
			{
				System.out.println("Erreur lors du Parsing des dates.");
			}
			finally
			{
				try{
					if (pstmt1 != null )
					{	
						pstmt1.close();
					}
 
					ConnectionManager.closeConnection(con);
				}catch(SQLException sqlex)
				{
					//TODO Integration Log4J
					sqlex.printStackTrace();
				}
			}
		}
		else
		{
			System.out.println("Connection null - erreur lors de la création");
		}
		return dataset;
	}
Merci d'avance