You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Geoffrey De Smet <ge...@gmail.com> on 2006/03/16 11:56:06 UTC

Java/POJO based FOP transformation (instead of XSL) like in JasperReports

I've worked with both FOP and JasperReports
and I really prefer the FO format over jasperreport's custom format.
But Jasperreports allows to use Java/POJO based transformations, so I am 
wondering if this is possible in FOP.

Basically the idea is to replace:
- generate XML based on POJO
- transform XML with XSL to FO
- feed FOP the FO
with
- supply POJO to "JSP without http" which generates FO
- feed FOP the FO

Does anyone know an (open source?) library which can do something like:

class Person {
   private String firstName;
   private String lastName;
   // getters and setters
}

...
<jspWithoutHttp:valueObject name="personList" 
class="java.util.List<Person>"/>
...
<% for (Person person : personList) { %>
   <fo:block>
     <%= person.getFirstName%>
   </fo:block>
   <fo:block>
     <%= person.getLastName%>
   </fo:block>
<% } %>
...

This should be usable in fat clients, webclients, ...: it is not bound 
to the HTTP protocol.

-- 
With kind regards,
Geoffrey De Smet


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Java/POJO based FOP transformation (instead of XSL) like in JasperReports

Posted by Jay Bryant <ja...@bryantcs.com>.
I don't know of such a library (which doesn't mean one doesn't exist), but
the concept is sound. All FOP needs is valid FO, regardless of how it's
generated.

Jay Bryant
Bryant Communication Services

----- Original Message ----- 
From: "Geoffrey De Smet" <ge...@gmail.com>
To: <fo...@xmlgraphics.apache.org>
Sent: Thursday, March 16, 2006 4:56 AM
Subject: Java/POJO based FOP transformation (instead of XSL) like in
JasperReports


> I've worked with both FOP and JasperReports
> and I really prefer the FO format over jasperreport's custom format.
> But Jasperreports allows to use Java/POJO based transformations, so I am
> wondering if this is possible in FOP.
>
> Basically the idea is to replace:
> - generate XML based on POJO
> - transform XML with XSL to FO
> - feed FOP the FO
> with
> - supply POJO to "JSP without http" which generates FO
> - feed FOP the FO
>
> Does anyone know an (open source?) library which can do something like:
>
> class Person {
>    private String firstName;
>    private String lastName;
>    // getters and setters
> }
>
> ...
> <jspWithoutHttp:valueObject name="personList"
> class="java.util.List<Person>"/>
> ...
> <% for (Person person : personList) { %>
>    <fo:block>
>      <%= person.getFirstName%>
>    </fo:block>
>    <fo:block>
>      <%= person.getLastName%>
>    </fo:block>
> <% } %>
> ...
>
> This should be usable in fat clients, webclients, ...: it is not bound
> to the HTTP protocol.
>
> -- 
> With kind regards,
> Geoffrey De Smet
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Java/POJO based FOP transformation (instead of XSL) like in JasperReports

Posted by Geoffrey De Smet <ge...@gmail.com>.
Velocity is indeed exactly what I need,
the only problem is that it's yet another language (probably easy to 
learn, but still). I wonder how hard it would be to create a Jelocity: 
Velocity with JSP-like syntax.

Christian Geisert wrote:
> Geoffrey De Smet schrieb:
>> I've worked with both FOP and JasperReports
>> and I really prefer the FO format over jasperreport's custom format.
>> But Jasperreports allows to use Java/POJO based transformations, so I 
>> am wondering if this is possible in FOP.
>>
>> Basically the idea is to replace:
>> - generate XML based on POJO
>> - transform XML with XSL to FO
>> - feed FOP the FO
>> with
>> - supply POJO to "JSP without http" which generates FO
>> - feed FOP the FO
>>
>> Does anyone know an (open source?) library which can do something like:
> 
> Sounds like a template engine like velocity[1] might be something for you.
> 
> Christian
> 
> [1] http://jakarta.apache.org/velocity/index.html

-- 
With kind regards,
Geoffrey De Smet


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Java/POJO based FOP transformation (instead of XSL) like in JasperReports

Posted by Christian Geisert <ch...@isu-gmbh.de>.
Geoffrey De Smet schrieb:
> I've worked with both FOP and JasperReports
> and I really prefer the FO format over jasperreport's custom format.
> But Jasperreports allows to use Java/POJO based transformations, so I am 
> wondering if this is possible in FOP.
> 
> Basically the idea is to replace:
> - generate XML based on POJO
> - transform XML with XSL to FO
> - feed FOP the FO
> with
> - supply POJO to "JSP without http" which generates FO
> - feed FOP the FO
> 
> Does anyone know an (open source?) library which can do something like:

Sounds like a template engine like velocity[1] might be something for you.

Christian

[1] http://jakarta.apache.org/velocity/index.html

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Java/POJO based FOP transformation (instead of XSL) like in JasperReports

Posted by Glen Mazza <gm...@apache.org>.
The SAX processing model (instead of constructing DOM trees to 
subsequently feed FOP) would probably be much faster for you.  No JSP 
needed for this.  I would take a look at Jeremias' ExampleObj2PDF[1] and 
corresponding model[2] to get an idea of the process.  I've been using 
this method at work for some time now and it has been working quite well 
for me.

Glen

[1] 
http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleObj2PDF.java?rev=332791&view=markup

[2]
http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/model/


Geoffrey De Smet wrote:

> I've worked with both FOP and JasperReports
> and I really prefer the FO format over jasperreport's custom format.
> But Jasperreports allows to use Java/POJO based transformations, so I am 
> wondering if this is possible in FOP.
> 
> Basically the idea is to replace:
> - generate XML based on POJO
> - transform XML with XSL to FO
> - feed FOP the FO
> with
> - supply POJO to "JSP without http" which generates FO
> - feed FOP the FO
> 
> Does anyone know an (open source?) library which can do something like:
> 
> class Person {
>   private String firstName;
>   private String lastName;
>   // getters and setters
> }
> 
> ...
> <jspWithoutHttp:valueObject name="personList" 
> class="java.util.List<Person>"/>
> ...
> <% for (Person person : personList) { %>
>   <fo:block>
>     <%= person.getFirstName%>
>   </fo:block>
>   <fo:block>
>     <%= person.getLastName%>
>   </fo:block>
> <% } %>
> ...
> 
> This should be usable in fat clients, webclients, ...: it is not bound 
> to the HTTP protocol.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org