You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bryan Field-Elliot <br...@netmeme.org> on 2002/03/10 23:04:24 UTC

Server-side Charting libs?

I was wondering if anyone has any positive experience with open-source
charting libraries, with Struts?

I need to generate a chart on the server (from a Struts action) and send
it back to the client as a Jpeg, PNG, etc.

I have messed with (a tiny bit) JFreeChart and Chart2d. Both appear (at
first glance) to have issues with "headless" environments, which my
server definitely is (no X server installed). I'm using JDK 1.3. At one
point I read that JDK 1.4 has better support for graphics primitives on
headless environments, but I don't know if the above two libraries can
take advantage of that.

A penny for anyone's thoughts?

Bryan




Re: No getter - method order bug?

Posted by Jon Ferguson <ca...@btinternet.com>.
Keith,

I suspect its more like if you overload you must overload both get and set.. eg..
if it takes an int there should be one that returns an int?.. Actually this
all falls down when you consider properties of arrays.. you can return the
whole array or one item.. but then the pattern is to have a get which takes an
int and returns an object..

Thanks for your input.. I think I Better be more rigorous in my namint!

Jon

keithBacon wrote:

> Hi Jon,
> Good debugging! I'd like to see some clear rules about struts & bean
> properties,
> so here's my attempt. (Not having read the bean spec very carefully!).
> 1 - If you want something treated as a property you must have get & set methods
> even if you won't call them both (from bean spec).
> 2 - Declare the get & set methods together (not necessary but good standard)
> most people do get before the set.
> 3 - If you overload the methods keep the matched pairs together.
>
> This is alarmimg. I figure if if follow these rules I won't hit any problems.
> It seems you've discovered that it's dangerous to overload methods that are
> properties. Has some-one got the time to get to the bottom of this?
> cheers - Keith.
>
> --- Jon Ferguson <ca...@btinternet.com> wrote:
> > Hey guys,
> >
> > I've finally managed to get this to work.. I thought it would be a classpath
> > prob.. but looks a bit more insidious.  In my CategoryWrapper class I
> > actually
> > had three relevant methods:
> > public void setMapping(int index)
> > public void setMapping(Map)
> > public Map getMapping()
> >
> > The first is only used for setting things up explicitly...  However because
> > it came before the others struts expects there to be a
> > public int getMapping() method.  Even though the one requred for the jsp is
> > available.  If I move "Map getMapping()" above the other
> > two in my source code this works.  Java does not
> > guarrantee order when listing methods with getDeclaredMethods()
> > so I suspect the logic:iterate tag is not testing the methods
> > correctly?
> >
> > Any other takes on this?  I realise I should probably change the
> > name of the first method to something like initializeMapping(int index)
> > but it doesn't seem like it should fail.. Especially since this
> > is likely to be random.
> >
> > Cheers,
> > Jon
> >
> > Jon Ferguson wrote:
> >
> > > Hey guys, anybody see this??  I've had the particular exception before but
> > > it's always been apparent what it was [eg. me :-) ].
> > >
> > > I'm developing on Linux and Windows 2k.
> > >
> > > I've built a struts/tiles app that works flawlessly under my
> > > linux setup but when I serve it from my Windows 2k box I'm
> > > getting :
> > >
> > > "No getter method for property mapping of bean category"
> > > when my jsp is hit.  The offending code uses a <logic:iterate>
> > > as follows:
> > >
> > > <logic:iterate id="category"
> > > type="uk.co.omegasoftware.util.struts.CategoryWrapper"
> > >                              name="itemListForm"
> > > property="categoryWrappers">
> > >         <tr>
> > >           <td>
> > >             <html:link page="/inventory.do" name="category"
> > > property="mapping">
> > >               <bean:write name="category" property="name" filter="true"/>
> > >             </html:link>
> > >           </td>
> > >         </tr>
> > > </logic:iterate>
> > >
> > > the CategoryWrapper class Does have the appropriate accessors:
> > > ...
> > >     public void setMapping(Map map) {
> > >         mapping = map;
> > >     }
> > >
> > >    public Map getMapping() {
> > >       return mapping;
> > >    }
> > > ...
> > >
> > > In both cases I'm using release versions of struts. I've tried 1.0: 1.0.1
> > > and 1.0.2
> > >
> > > I'm running on Tomcat 4.0-b6 on my Linux box..
> > > I've tried: Tomcat 4.0.1, 3.2.3, and 4.0 on my Windows box.
> > >
> > > I'm using JDK 1.4.0-beta on linux
> > > I've tried JDK 1.3.1, 1.4.0-beta and 1.4.0-beta3 on windows
> > >
> > > Any ideas??
> > >
> > > Thanks,
> > >
> > > Jon
> > >
> > >   ------------------------------------------------------------------------
> > >    Part 1.2Type: Plain Text (text/plain)
> >
> > > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
>
> =====
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Search the archive:-
> http://www.mail-archive.com/struts-user%40jakarta.apache.org/
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Keith Bacon - Looking for struts work - South-East UK.
> phone UK 07960 011275
>
> __________________________________________________
> Do You Yahoo!?
> Try FREE Yahoo! Mail - the world's greatest free email!
> http://mail.yahoo.com/
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: No getter - method order bug?

Posted by keithBacon <ke...@yahoo.com>.
Hi Jon,
Good debugging! I'd like to see some clear rules about struts & bean
properties,
so here's my attempt. (Not having read the bean spec very carefully!).
1 - If you want something treated as a property you must have get & set methods
even if you won't call them both (from bean spec).
2 - Declare the get & set methods together (not necessary but good standard)
most people do get before the set. 
3 - If you overload the methods keep the matched pairs together.

This is alarmimg. I figure if if follow these rules I won't hit any problems.
It seems you've discovered that it's dangerous to overload methods that are
properties. Has some-one got the time to get to the bottom of this?
cheers - Keith.

--- Jon Ferguson <ca...@btinternet.com> wrote:
> Hey guys,
> 
> I've finally managed to get this to work.. I thought it would be a classpath
> prob.. but looks a bit more insidious.  In my CategoryWrapper class I
> actually
> had three relevant methods:
> public void setMapping(int index)
> public void setMapping(Map)
> public Map getMapping()
> 
> The first is only used for setting things up explicitly...  However because
> it came before the others struts expects there to be a
> public int getMapping() method.  Even though the one requred for the jsp is
> available.  If I move "Map getMapping()" above the other
> two in my source code this works.  Java does not
> guarrantee order when listing methods with getDeclaredMethods()
> so I suspect the logic:iterate tag is not testing the methods
> correctly?
> 
> Any other takes on this?  I realise I should probably change the
> name of the first method to something like initializeMapping(int index)
> but it doesn't seem like it should fail.. Especially since this
> is likely to be random.
> 
> Cheers,
> Jon
> 
> Jon Ferguson wrote:
> 
> > Hey guys, anybody see this??  I've had the particular exception before but
> > it's always been apparent what it was [eg. me :-) ].
> >
> > I'm developing on Linux and Windows 2k.
> >
> > I've built a struts/tiles app that works flawlessly under my
> > linux setup but when I serve it from my Windows 2k box I'm
> > getting :
> >
> > "No getter method for property mapping of bean category"
> > when my jsp is hit.  The offending code uses a <logic:iterate>
> > as follows:
> >
> > <logic:iterate id="category"
> > type="uk.co.omegasoftware.util.struts.CategoryWrapper"
> >                              name="itemListForm"
> > property="categoryWrappers">
> >         <tr>
> >           <td>
> >             <html:link page="/inventory.do" name="category"
> > property="mapping">
> >               <bean:write name="category" property="name" filter="true"/>
> >             </html:link>
> >           </td>
> >         </tr>
> > </logic:iterate>
> >
> > the CategoryWrapper class Does have the appropriate accessors:
> > ...
> >     public void setMapping(Map map) {
> >         mapping = map;
> >     }
> >
> >    public Map getMapping() {
> >       return mapping;
> >    }
> > ...
> >
> > In both cases I'm using release versions of struts. I've tried 1.0: 1.0.1
> > and 1.0.2
> >
> > I'm running on Tomcat 4.0-b6 on my Linux box..
> > I've tried: Tomcat 4.0.1, 3.2.3, and 4.0 on my Windows box.
> >
> > I'm using JDK 1.4.0-beta on linux
> > I've tried JDK 1.3.1, 1.4.0-beta and 1.4.0-beta3 on windows
> >
> > Any ideas??
> >
> > Thanks,
> >
> > Jon
> >
> >   ------------------------------------------------------------------------
> >    Part 1.2Type: Plain Text (text/plain)
> 
> > --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Search the archive:-
http://www.mail-archive.com/struts-user%40jakarta.apache.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Keith Bacon - Looking for struts work - South-East UK.
phone UK 07960 011275

__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: No getter - method order bug?

Posted by Jon Ferguson <ca...@btinternet.com>.
Hey guys,

I've finally managed to get this to work.. I thought it would be a classpath
prob.. but looks a bit more insidious.  In my CategoryWrapper class I
actually
had three relevant methods:
public void setMapping(int index)
public void setMapping(Map)
public Map getMapping()

The first is only used for setting things up explicitly...  However because
it came before the others struts expects there to be a
public int getMapping() method.  Even though the one requred for the jsp is
available.  If I move "Map getMapping()" above the other
two in my source code this works.  Java does not
guarrantee order when listing methods with getDeclaredMethods()
so I suspect the logic:iterate tag is not testing the methods
correctly?

Any other takes on this?  I realise I should probably change the
name of the first method to something like initializeMapping(int index)
but it doesn't seem like it should fail.. Especially since this
is likely to be random.

Cheers,
Jon

Jon Ferguson wrote:

> Hey guys, anybody see this??  I've had the particular exception before but
> it's always been apparent what it was [eg. me :-) ].
>
> I'm developing on Linux and Windows 2k.
>
> I've built a struts/tiles app that works flawlessly under my
> linux setup but when I serve it from my Windows 2k box I'm
> getting :
>
> "No getter method for property mapping of bean category"
> when my jsp is hit.  The offending code uses a <logic:iterate>
> as follows:
>
> <logic:iterate id="category"
> type="uk.co.omegasoftware.util.struts.CategoryWrapper"
>                              name="itemListForm"
> property="categoryWrappers">
>         <tr>
>           <td>
>             <html:link page="/inventory.do" name="category"
> property="mapping">
>               <bean:write name="category" property="name" filter="true"/>
>             </html:link>
>           </td>
>         </tr>
> </logic:iterate>
>
> the CategoryWrapper class Does have the appropriate accessors:
> ...
>     public void setMapping(Map map) {
>         mapping = map;
>     }
>
>    public Map getMapping() {
>       return mapping;
>    }
> ...
>
> In both cases I'm using release versions of struts. I've tried 1.0: 1.0.1
> and 1.0.2
>
> I'm running on Tomcat 4.0-b6 on my Linux box..
> I've tried: Tomcat 4.0.1, 3.2.3, and 4.0 on my Windows box.
>
> I'm using JDK 1.4.0-beta on linux
> I've tried JDK 1.3.1, 1.4.0-beta and 1.4.0-beta3 on windows
>
> Any ideas??
>
> Thanks,
>
> Jon
>
>   ------------------------------------------------------------------------
>    Part 1.2Type: Plain Text (text/plain)


No getter

Posted by Jon Ferguson <ca...@btinternet.com>.
Hey guys, anybody see this??  I've had the particular exception before but
it's always been apparent what it was [eg. me :-) ].

I'm developing on Linux and Windows 2k.

I've built a struts/tiles app that works flawlessly under my
linux setup but when I serve it from my Windows 2k box I'm
getting :

"No getter method for property mapping of bean category"
when my jsp is hit.  The offending code uses a <logic:iterate>
as follows:

<logic:iterate id="category"
type="uk.co.omegasoftware.util.struts.CategoryWrapper"
                             name="itemListForm"
property="categoryWrappers">
        <tr>
          <td>
            <html:link page="/inventory.do" name="category"
property="mapping">
              <bean:write name="category" property="name" filter="true"/>
            </html:link>
          </td>
        </tr>
</logic:iterate>

the CategoryWrapper class Does have the appropriate accessors:
...
    public void setMapping(Map map) {
        mapping = map;
    }

   public Map getMapping() {
      return mapping;
   }
...

In both cases I'm using release versions of struts. I've tried 1.0: 1.0.1
and 1.0.2

I'm running on Tomcat 4.0-b6 on my Linux box..
I've tried: Tomcat 4.0.1, 3.2.3, and 4.0 on my Windows box.

I'm using JDK 1.4.0-beta on linux
I've tried JDK 1.3.1, 1.4.0-beta and 1.4.0-beta3 on windows

Any ideas??

Thanks,

Jon





Re: Server-side Charting libs?

Posted by Arron Bates <ar...@pacific.net.au>.
Java 1.2 should be all you'd need for a good charting package. Not that 
I have a particular library in mind. I have seen one on sourceforge 
someplace. They are out there.

When ever I've needed a chart I've luckily had to the time to piss 
around and make it myself. Java2D in 1.2 should be all anyone needs to 
get the job done. Has the ability for some very sexy imagery.

You can use any charting package, as long as it will render to an Image 
object or some sort (Buffered or otherwise) which you can just pump from 
a Struts action using Sun's own JPEG output stream, which you can get a 
hold of in thier Advanced Imaging Toolkit or something (www.javasoft.com 
:) . With that you set the quality etc. As far as I know all the JPEG 
stuff etc is now in 1.4


Arron.

Bryan Field-Elliot wrote:

>I was wondering if anyone has any positive experience with open-source
>charting libraries, with Struts?
>
>I need to generate a chart on the server (from a Struts action) and send
>it back to the client as a Jpeg, PNG, etc.
>
>I have messed with (a tiny bit) JFreeChart and Chart2d. Both appear (at
>first glance) to have issues with "headless" environments, which my
>server definitely is (no X server installed). I'm using JDK 1.3. At one
>point I read that JDK 1.4 has better support for graphics primitives on
>headless environments, but I don't know if the above two libraries can
>take advantage of that.
>
>A penny for anyone's thoughts?
>
>Bryan
>
>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Server-side Charting libs?

Posted by Bill Lynch <bi...@jivesoftware.com>.
Bryan,

> I don't know what Xvfb is, can you give me a pointer to an explanation?
> Is it something that's part of AWT, or part of jCharts, or something
> else?

An alternative to Xvfb is the PJA Toolkit:
http://www.eteks.com/pja/en/

Cheers,
--Bill


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Server-side Charting libs?

Posted by Matt Read <mr...@dircon.co.uk>.
X Virtual Frame Buffer - it's part of xfree86 and stands in for a full
X-server when you don't actually need one, i.e. on a web-server. Have a look
at http://www.davisor.com/chart/doc/headless.html and search for "How can I
setup a virtual framebuffer for Linux?".

Matt.

-----Original Message-----
From: Bryan Field-Elliot [mailto:bryan_lists@netmeme.org]
Sent: 10 March 2002 22:21
To: Struts Users Mailing List
Subject: RE: Server-side Charting libs?


Thanks,

I don't know what Xvfb is, can you give me a pointer to an explanation?
Is it something that's part of AWT, or part of jCharts, or something
else?

Thanks,

Bryan

On Sun, 2002-03-10 at 15:12, Matt Read wrote:

    I use jCharts (jcharts.sourceforge.net) which is the best I've found for
the
    actual chart creation but you still have the same problem with the Java
1.3
    AWT libraries needing an X server. I just use Xvfb which seems to work
fine,
    let me know if you need any help configuring it. Other than that I've
also
    looked at the Java 1.4, attempted to follow the instructions at

http://java.sun.com/products/java-media/2D/forDevelopers/java2dfaq.html#xvfb
    with no luck and went back to Xvfb. Let me know if you get it working.

    Matt.

    -----Original Message-----
    From: Bryan Field-Elliot [mailto:bryan_lists@netmeme.org]
    Sent: 10 March 2002 22:04
    To: struts-user@jakarta.apache.org
    Subject: Server-side Charting libs?


    I was wondering if anyone has any positive experience with open-source
    charting libraries, with Struts?

    I need to generate a chart on the server (from a Struts action) and send
    it back to the client as a Jpeg, PNG, etc.

    I have messed with (a tiny bit) JFreeChart and Chart2d. Both appear (at
    first glance) to have issues with "headless" environments, which my
    server definitely is (no X server installed). I'm using JDK 1.3. At one
    point I read that JDK 1.4 has better support for graphics primitives on
    headless environments, but I don't know if the above two libraries can
    take advantage of that.

    A penny for anyone's thoughts?

    Bryan





    --
    To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
    For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Server-side Charting libs?

Posted by Bryan Field-Elliot <br...@netmeme.org>.
Thanks,

I don't know what Xvfb is, can you give me a pointer to an explanation?
Is it something that's part of AWT, or part of jCharts, or something
else?

Thanks,

Bryan

On Sun, 2002-03-10 at 15:12, Matt Read wrote:

    I use jCharts (jcharts.sourceforge.net) which is the best I've found for the
    actual chart creation but you still have the same problem with the Java 1.3
    AWT libraries needing an X server. I just use Xvfb which seems to work fine,
    let me know if you need any help configuring it. Other than that I've also
    looked at the Java 1.4, attempted to follow the instructions at
    http://java.sun.com/products/java-media/2D/forDevelopers/java2dfaq.html#xvfb
    with no luck and went back to Xvfb. Let me know if you get it working.
    
    Matt.
    
    -----Original Message-----
    From: Bryan Field-Elliot [mailto:bryan_lists@netmeme.org]
    Sent: 10 March 2002 22:04
    To: struts-user@jakarta.apache.org
    Subject: Server-side Charting libs?
    
    
    I was wondering if anyone has any positive experience with open-source
    charting libraries, with Struts?
    
    I need to generate a chart on the server (from a Struts action) and send
    it back to the client as a Jpeg, PNG, etc.
    
    I have messed with (a tiny bit) JFreeChart and Chart2d. Both appear (at
    first glance) to have issues with "headless" environments, which my
    server definitely is (no X server installed). I'm using JDK 1.3. At one
    point I read that JDK 1.4 has better support for graphics primitives on
    headless environments, but I don't know if the above two libraries can
    take advantage of that.
    
    A penny for anyone's thoughts?
    
    Bryan
    
    
    
    
    
    --
    To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
    For additional commands, e-mail: <ma...@jakarta.apache.org>
    
    

RE: Server-side Charting libs?

Posted by Matt Read <mr...@dircon.co.uk>.
I use jCharts (jcharts.sourceforge.net) which is the best I've found for the
actual chart creation but you still have the same problem with the Java 1.3
AWT libraries needing an X server. I just use Xvfb which seems to work fine,
let me know if you need any help configuring it. Other than that I've also
looked at the Java 1.4, attempted to follow the instructions at
http://java.sun.com/products/java-media/2D/forDevelopers/java2dfaq.html#xvfb
with no luck and went back to Xvfb. Let me know if you get it working.

Matt.

-----Original Message-----
From: Bryan Field-Elliot [mailto:bryan_lists@netmeme.org]
Sent: 10 March 2002 22:04
To: struts-user@jakarta.apache.org
Subject: Server-side Charting libs?


I was wondering if anyone has any positive experience with open-source
charting libraries, with Struts?

I need to generate a chart on the server (from a Struts action) and send
it back to the client as a Jpeg, PNG, etc.

I have messed with (a tiny bit) JFreeChart and Chart2d. Both appear (at
first glance) to have issues with "headless" environments, which my
server definitely is (no X server installed). I'm using JDK 1.3. At one
point I read that JDK 1.4 has better support for graphics primitives on
headless environments, but I don't know if the above two libraries can
take advantage of that.

A penny for anyone's thoughts?

Bryan





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>