I managed to get the <img src tag to render the chart correctly. Problem
was a sill "/" in the namespace definition of package defining
jfreechart actions in struts.xml. I still have a problem with the ajax
side. 

 

The following 

            <img id="indicator1" src="/images/indicator.gif"

                     alt="Loading Info" style="display:none"/>

<s:url id="ajaxCallUrl" value="/chart/ViewSimpleXYChart.html"/>

            <s:div theme="ajax"

                           href="%{ajaxCallUrl}"  loadingText="Loading
Chart..." indicator="indicator1">

            </s:div> 

Gets to the action and returns the chart, but renders it as text in the
<s:div. I must somehow tell to render it as a png. This is on IE7. On
Firefox I get the following error:

FATAL exception raised: Could not load 'struts.widget.Bind'; last tried
'__package__.js'

 

I have <s:head in my <head> section to enable ajax.

With firefox, if I comment out the sitemesh filter in web.xml, I get the
same results as in IE7.?

 

Travers

 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt
Raible
Sent: 12 July 2007 03:49 PM
To: [email protected]
Subject: Re: [appfuse-user] using ajax to render a chart in appfuse 2 m5

 

I don't know enough about Charts to determine if they're using an HTML
template loaded from a JAR file or anything like that. My guess is not.
If you can render an image from going to a specific URL in your browser,
you should be able to use a regular <img src=> tag to point to that URL
and render the image in your page. Maybe you don't need to use Struts'
<img:> tag? 

 

Matt

On 7/12/07, Travers Snyman <[EMAIL PROTECTED] > wrote:

Thanks Matt for the reply,
I am really quite confused. If I try src="/chart/ViewSimpleXYChart
.html"
I still get a There is no Action mapped for namespace /chart and action
name
Exception.

I don't understand how the menu finds the action though. In menu-config
I have
    <Menu name="XYChartMenu"  title=" menu.xyChart"
                                        description="XY Chart Menu"
page="/ViewSimpleXYChart.html" />

    which renders the chart, but not to my jsp

Also if I add a namespace="chart" to the chart package definition in 
struts.xml then the menu does not work anymore even if the page
parameter points to page="/ViewSimpleXYChart.html" />

Do I maybe need to change anything on the struts filter in web.xml ?

Travers

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt
Raible
Sent: 12 July 2007 01:45 PM 
To: [email protected]
Subject: Re: [appfuse-user] using ajax to render a chart in appfuse 2 m5

Looking at your action definition, I believe the URL should be 
src="/chart/ViewSimpleXYChart.html".

Matt

On 7/12/07, Travers Snyman <[EMAIL PROTECTED]> wrote:
>
>
>
>
> I think my problem has to do with struts namespaces. The jsp I am 
using the ajax call from is in the default package and the chart action
in another package called "chart" because I have to extend
jfreechart-default here. My problem is <img:image
src="/viewSimpleXYChart.html"/ > gives
>
>
>
> There is no Action mapped for namespace / and action name
viewSimpleXYChart. - [unknown location]
>
>
>
> Any help appreciated
>
>
>
> Travers
>
>   ________________________________

>
> From: Travers Snyman [mailto:[EMAIL PROTECTED]
>  Sent: 10 July 2007 02:41 PM 
>  To: [email protected]
>  Subject: [appfuse-user] using ajax to render a chart in appfuse 2 m5
>
>
>
>
> Hi,
>
> I created a simple action class to generate a chart. I use the
struts-jfreechart plugin to get the chart result type. I now want to
render the chart by doing something like this in a jsp:
>
>
> 
> <s:url id="ajaxChartUrl" value="/viewSimpleXYChart.html"/>
>
> <s:div theme="ajax"
>
>                href="%{ ajaxChartUrl }" loadingText="Loading Chart..."

>
>
> </s:div>
>
>
>
> My struts.xml is configured as follows:
>
>
>
>         <package name = "chart" extends="jfreechart-default"> 
>
>            <action name="ViewSimpleXYChart"
class="cam.webapp.action.XYChartAction" >
>
>              <result name="success" type="chart"> 
>
>                </result>
>
>             </action>
>
>          </package>
>
>
>
> If I use menu to point to viewSimpleXYChart.html, the action is hit 
and the chart displayed in a blank page, however hitting the jsp with
the ajax stuff does nothing (no error traces), actions execute() method
is simply not accessed.
>
>
>
> Also I thought the following would work from a normal appfuse jsp page

>
>
>
> <img:image src="/viewSimpleXYChart.html"/>
>
>
>
> But it seems to be the same problem. I am sure I am missing something
fundamentally simple here. The action will generate the chart as png, 
and the getChart method place it on the value stack and the references
in the jsp get it from there and display it in the <s:div section ? I
intend using this type of ajax method for a dashboard using Jfreecharts.

>
>
>
> Thanks
>
> Travers



--
http://raibledesigns.com


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

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




-- 
http://raibledesigns.com 

Reply via email to