posted 17 years ago
ok.
data could be extracted from database in the servlet which generates the chart.
Reading your posts shows to me that my method is wrong. I have to extract data into the servlet code only when needed.
The whole code is very poor because the code is very simple. Here the code for the servlet dispatch.do
What i was trying to do ? First, daovaleurs is a bean that requests the database according to some paramaters. Result is an ArrayList() with some hundred elements.
My idea is that i can request once time the database for the same parameters, so the database server is used only when new data is needed. The result is put into an Attribute. And this attribute is dispatched to the JSP view. there is more than one JSP view possible, the "forwarding" is according to a "dispatch.do" parameter (name "mode").
here is the code for the page_graphique.jsp :
here is the code of the generer_graphique.do servlet :
With these codes, the daovaleurs Attribute is null into the generer_graphique.do servlet. This is "normal". My first question was is there one method to "put" the daovaleurs bean from the JSP to the servlet called by the <img> tag ? because i want to extend the JSP to display a table with the same daovaleurs bean.
if i understand what you have written, this is not possible.
I'm going to explain another time what i was looking for. Sorry if my english is bad. Well, i want to build a simple webapp which can request
many times the database server. Data extracted can be "important", like some hundrer of element. Each data extracted can be displayed as tables, charts or maps. With the idea to minimize the amount of real requests to the database server, i thought using a "cache" Attribute which can be used by any JSP view. Each JSP view can display the data as it wants. For example, the page_graphique.jsp view can display just one chart, but in my mind, could display with the same data Attribute chart AND table. So, only one request was done for the same data.
in this context, i was trying to implement the webapp in a MVC structure, so i use a central servlet which extracts data and forwards them to the right JSP view. Each JSP view can display the data how it wants (charts, maps, tables with the same data).