--- On Wed, 8/6/08, dynamicd <[EMAIL PROTECTED]> wrote:
> Also tried implementing the SessionAware. However the same thing.

Why?

Did you try setting the headers for not caching?

Dave

> dynamicd wrote:
> > 
> > This is cool.. I tried it out. However once the 
> > chart_display.jsp is called the first time through the
> image tag. it does
> > not call the DisplayChart.action again to refresh the
> image with a new one
> > when clicked on the DrawChart.action. (I added the
> println statement in
> > the display method to find out that the div is not
> refreshing)  I have to
> > log out and log in (invalidate session) to get the new
> chart. I am missing
> > something
> > 
> > 
> >       
> >       public String display() throws Exception {
> >           System.out.println("I AM IN THE DISPLAY
> NOW "); 
> >                 Map attributes =
> ActionContext.getContext().getSession();
> >             this.chart = (JFreeChart)
> attributes.get("CHART");
> >             
> >             if(chart == null) {
> >                 return Constants.FORWARD_INVALIDACTION;
> >             }
> >             return Constants.FORWARD_SUCCESS;
> >         } 
> >       
> >      
> >      private void setChart(JFreeChart chart){
> >              Map attributes =
> ActionContext.getContext().getSession();
> >              attributes.put("CHART", null);
> >              this.chart = chart;
> >              attributes.put("CHART", this.chart);
> >      }
> > 
> > public JFreeChart getChart() {
> >             return chart;
> >     }
> > 
> > 
> > 
> > Leena Borle wrote:
> >> 
> >> Hello,
> >>  See if this helps you.
> >>  I have a form with remote DIV which displays
> chart after user clicks on
> >> submit.
> >> Trick here is to generate chart object, store it
> in session and display
> >> it
> >> in separate JSP.   Remove the form part if you
> want to display just the
> >> dynamic-DIV using Chart image.
> >> 
> >> Form.jsp [
> >>         <s:form>
> >>             <s:url id="display_chart"
> value="DrawChart_draw.action"
> >> namespace="/user" />
> >> 
> >>             <s:submit value="Draw
> chart" href="%{display_chart}"
> >> theme="ajax"
> targets="*chart_div*"  />
> >>             <br />
> >>          </s:form>
> >> 
> >>     <h4>Your Running Chart</h4>
> >>         <div id="*chart_div*">
> >>         </div>    <!-- End display chart
> -->
> >>     </div>
> >> 
> >> ]
> >> 
> >> 
> >> display_chart.jsp [
> >> <body>
> >> 
> >>       /MyApp/user/DrawChart_display.action 
> >> </body>
> >> 
> >> ]
> >> 
> >> 
> >> struts.xml[
> >>            <package name="user" 
> extends
> >> ="struts-default,jfreechart-default">
> >>             <!--  Separate method to draw and 
> display due to Remote
> >> DIV/Button tag contsraints.
> >>              -->
> >>             <action
> name="DrawChart_input" method="input"
> >> class=".xxx.DrawChart">
> >>                     <result
> name="input">form.jsp </result>
> >>             </action>
> >> 
> >>             <action
> name="DrawChart_draw" method="draw"
> >> class="xxx..DrawChart">
> >>                     <result
> name="success">/jsp/display_chart.jsp
> >> </result>
> >>             </action>
> >>             <action
> name="DrawChart_display"
> method="display"
> >> class="xxx.DrawChart">
> >>                     <result
> name="success" type="chart">
> >>                         400
> >>                         300
> >>                      </result>
> >>             </action>
> >> 
> >>            </package>
> >> ]
> >> 
> >> 
> >> DrawChart.java [
> >>      JFreeChart chart;
> >>     public String draw() throws Exception {
> >>                  //chart creation logic.
> >>               //generate chart object
> >>               chart = ....
> >>              session = ....
> >>              session.put("CHART",
> chart);
> >>             return success;
> >>     }
> >> 
> >>     /**
> >>      * returns chart obejct from the session.
> >>        This methos is used by display_chart.jsp
> >>     */
> >>     public String display() throws Exception {
> >>         session = ...get session ...
> >>         this.chart = (JFreeChart)
> session.get("CHART");
> >>         if(chart == null) {
> >>            
> addActionError(getText("error.nochart"));
> >>             return ERROR;
> >>         }
> >>         return SUCCESS;
> >>     }
> >> 
> >>     // this method will get called if we specify
> chart
> >>     public JFreeChart getChart() {
> >>             return chart;
> >>     }
> >> 
> >>     /**
> >>      * <p> input action
> >>      */
> >>     public String input() throws Exception {
> >>         return INPUT;
> >>     }
> >> 
> >> ]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to