views:

122

answers:

1

All,

I have been trying to use this guide to render a JFreeChart on a JSP page. Could someone help me out with the JSP code required to show this on a tabbed panel using the struts-dojo-tags.

Eventually I want to render a different graph on each tab and refresh them using AJAX.

At the moment I have configured everything as shown in the link.

Update:

Here is the code from the struts2 guide which I am using:

 <sx:tabbedpanel id="tabContainer">
   <sx:div label="Local Tab 1" >
       Tab 1
   </sx:div>   
   <sx:div label="Remote Tab 2" href="%{#url}">
       Remote Tab 2
   </sx:div>   
</sx:tabbedpanel>

Where url refers to my action which returns the chart result. This returns a lot of symbols on the tab so clearly it can't show the returned png.

I can also view the chart if I insert <img src="http://localhost:8080/myApp/myaction"&gt; so the action does work correctly.

Do I need to create another JSP page which the url can point to which simply contains an image which gets a chart from my action?

Thanks,

Alex

A: 

I would suggest that you start gradually in steps

  1. Make sure that the chart is indeed created (already done)

  2. Create a single HTML page with an img tag that points to the url (see if this works)

  3. Create a single JSP page with an img tag (see if this works)

  4. Create a Struts 2 JSP page with an img tag (see if this works)

  5. Create a Struts 2 JSP page with an img tag in a tab (see if this works)

  6. Create a Struts 2 JSP page with an img tag in a tab that updates dymanically with Ajax

This way you can isolate the problem instead of throwing everything in the mix at once.

But in general you do NOT need another JSP page that contains the image.

kazanaki