[S2] Design Advice Needed

2007-08-02 Thread Hoying, Ken
I could use some advice from some folks with more experience and
knowledge of Struts2 than I to assist me in determining the correct way
(or lay out some viable options) to design a solution for the following
senario:

We need to generate a PDF report real time based on data in a database
that is available for download.  What we believe that we would like to
do is utilize FOP (http://xmlgraphics.apache.org/fop/) and use a JSP
page to actually generate the formatting objects and then run the
formatting objects through the FOP processor to generate and stream the
PDF back to the user.  

However, we are not real sure how to implement this in Struts2.  How do
we invoke the JSP page and then get access to the results?  Do we just
use the stream result type and then use a http call to the JSP as the
input source?  This would seem like it would not be optimal from a
performance standpoint, as we are making another http call to get the
formatting objects from the jsp.  It also adds the complexity of passing
security credentials in the call.  Or do we need to somehow create or
own result type and if so how do we get those JSP results?  I have not
really found any good documentation or example on writing your own
result types.

Thanks in advance!



-
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.  

Re: [S2] Design Advice Needed

2007-08-02 Thread Rene Gielen
You should definitely have a look into the struts2-jasperreports-plugin
- both for checking out how to write own results and evaluating if you
might want to use jasper over FOP, since full s2 result support is
already available for jasper.

The plugin is part of the struts2 source distribution.

Regards,
Rene

Hoying, Ken schrieb:
 I could use some advice from some folks with more experience and
 knowledge of Struts2 than I to assist me in determining the correct way
 (or lay out some viable options) to design a solution for the following
 senario:
 
 We need to generate a PDF report real time based on data in a database
 that is available for download.  What we believe that we would like to
 do is utilize FOP (http://xmlgraphics.apache.org/fop/) and use a JSP
 page to actually generate the formatting objects and then run the
 formatting objects through the FOP processor to generate and stream the
 PDF back to the user.  
 
 However, we are not real sure how to implement this in Struts2.  How do
 we invoke the JSP page and then get access to the results?  Do we just
 use the stream result type and then use a http call to the JSP as the
 input source?  This would seem like it would not be optimal from a
 performance standpoint, as we are making another http call to get the
 formatting objects from the jsp.  It also adds the complexity of passing
 security credentials in the call.  Or do we need to somehow create or
 own result type and if so how do we get those JSP results?  I have not
 really found any good documentation or example on writing your own
 result types.
 
 Thanks in advance!
 
 
 
 -
 ***Note:The information contained in this message may be privileged
 and confidential and protected from disclosure. If the reader of
 this message is not the intended recipient, or an employee or agent
 responsible for delivering this message to the intended recipient,
 you are hereby notified that any dissemination, distribution or
 copying of this communication is strictly prohibited. If you have
 received this communication in error, please notify the Sender
 immediately by replying to the message and deleting it from your
 computer. Thank you. Premier Inc.  

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



Re: [S2] Design Advice Needed

2007-08-02 Thread Mike Baroukh
I suppose there is a lot of other way to generate pdf with struts2. 
Certainly a plugin. But I don't know how it works.


However, to invoke a jsp and get the result in your action, you can use 
a requestDispatcher to obtain the resut of a jsp execution.


Here is something I already done with struts1. I have problems now with 
struts2's request dispatcher. So I don't know if it still work ...



request.setAttribute(param1, valuepram1);
...
Eventally, had a path to an embeded image :
request.setAttribute(logo, 
MyActionClass.class.getClassLoader().getResource(/path/to/th/logo.gif).getFile());


ResponseWrapper responseWrapper = new ResponseWrapper(response);


getServlet().getServletContext().getRequestDispatcher(path/to/the/fop-jsp.jsp).include(request, 
responseWrapper).include(request, responseWrapper);


you can use now
byte[] bytes = responseWrapper.getBytes();
to get the file generated by the jsp.


responseWrapper is a simple class like :


public static class ResponseWrapper extends HttpServletResponseWrapper {

private ByteArrayOutputStream baos = new ByteArrayOutputStream();
private ServletOutputStream sos = new ServletOutputStream() {
public void write(int b) throws IOException {
baos.write(b);
}
};
private PrintWriter osw = new PrintWriter(new 
OutputStreamWriter(baos));

public ResponseWrapper(HttpServletResponse response) {
super(response);
}

public ServletOutputStream getOutputStream() throws 
IOException {

return sos;
}

public PrintWriter getWriter() throws IOException {
return osw;
}

public byte[] getBytes() {
osw.flush();
return baos.toByteArray();
}

}

Hoying, Ken a écrit :

I could use some advice from some folks with more experience and
knowledge of Struts2 than I to assist me in determining the correct way
(or lay out some viable options) to design a solution for the following
senario:

We need to generate a PDF report real time based on data in a database
that is available for download.  What we believe that we would like to
do is utilize FOP (http://xmlgraphics.apache.org/fop/) and use a JSP
page to actually generate the formatting objects and then run the
formatting objects through the FOP processor to generate and stream the
PDF back to the user.  


However, we are not real sure how to implement this in Struts2.  How do
we invoke the JSP page and then get access to the results?  Do we just
use the stream result type and then use a http call to the JSP as the
input source?  This would seem like it would not be optimal from a
performance standpoint, as we are making another http call to get the
formatting objects from the jsp.  It also adds the complexity of passing
security credentials in the call.  Or do we need to somehow create or
own result type and if so how do we get those JSP results?  I have not
really found any good documentation or example on writing your own
result types.

Thanks in advance!



-
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.  


--

Mike Baroukh

---
Cardiweb  - 31 Rue de Mogador Paris IXeme
06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED]
http://www.cardiweb.com
---


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



RE: [S2] Design Advice Needed

2007-08-02 Thread Hoying, Ken
Thanks, Rene!

I actually just found that after sending my question.  Somehow I missed
it earlier.  We are definitely going to take a look at Jasper and the
plugin as it appears a lot of the heavy lifting may already be done for
us. 

Thank you!

-Original Message-
From: Rene Gielen [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 02, 2007 8:07 AM
To: Struts Users Mailing List
Subject: Re: [S2] Design Advice Needed

You should definitely have a look into the struts2-jasperreports-plugin
- both for checking out how to write own results and evaluating if you
might want to use jasper over FOP, since full s2 result support is
already available for jasper.

The plugin is part of the struts2 source distribution.

Regards,
Rene

Hoying, Ken schrieb:
 I could use some advice from some folks with more experience and 
 knowledge of Struts2 than I to assist me in determining the correct 
 way (or lay out some viable options) to design a solution for the 
 following
 senario:
 
 We need to generate a PDF report real time based on data in a database

 that is available for download.  What we believe that we would like to

 do is utilize FOP (http://xmlgraphics.apache.org/fop/) and use a JSP 
 page to actually generate the formatting objects and then run the 
 formatting objects through the FOP processor to generate and stream 
 the PDF back to the user.
 
 However, we are not real sure how to implement this in Struts2.  How 
 do we invoke the JSP page and then get access to the results?  Do we 
 just use the stream result type and then use a http call to the JSP as

 the input source?  This would seem like it would not be optimal from a

 performance standpoint, as we are making another http call to get the 
 formatting objects from the jsp.  It also adds the complexity of 
 passing security credentials in the call.  Or do we need to somehow 
 create or own result type and if so how do we get those JSP results?  
 I have not really found any good documentation or example on writing 
 your own result types.
 
 Thanks in advance!
 
 
 
 -
 ***Note:The information contained in this message may be privileged 
 and confidential and protected from disclosure. If the reader of this 
 message is not the intended recipient, or an employee or agent 
 responsible for delivering this message to the intended recipient, you

 are hereby notified that any dissemination, distribution or copying of

 this communication is strictly prohibited. If you have received this 
 communication in error, please notify the Sender immediately by 
 replying to the message and deleting it from your computer. Thank you.

 Premier Inc.

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


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



RE: [S2] Design Advice Needed

2007-08-02 Thread Wesley Wannemacher
Having used FOP briefly, I would add only one thing. It is generally
considered a good practice to generate traditional XML first, then
transform your data to XSLFO using a transform (pardon me if I am
getting the terms wrong). Basically, create your XML data, then have an
XSL file that transforms your data to FO, then use FOP to transform it
into a PDF. 

I saw a few responses that seem to indicate you may choose Jasper, which
is likely a better idea anyways.

-Wes 

-Original Message-
From: Hoying, Ken [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 02, 2007 7:40 AM
To: user@struts.apache.org
Subject: [S2] Design Advice Needed

I could use some advice from some folks with more experience and
knowledge of Struts2 than I to assist me in determining the correct way
(or lay out some viable options) to design a solution for the following
senario:

We need to generate a PDF report real time based on data in a database
that is available for download.  What we believe that we would like to
do is utilize FOP (http://xmlgraphics.apache.org/fop/) and use a JSP
page to actually generate the formatting objects and then run the
formatting objects through the FOP processor to generate and stream the
PDF back to the user.  

However, we are not real sure how to implement this in Struts2.  How do
we invoke the JSP page and then get access to the results?  Do we just
use the stream result type and then use a http call to the JSP as the
input source?  This would seem like it would not be optimal from a
performance standpoint, as we are making another http call to get the
formatting objects from the jsp.  It also adds the complexity of passing
security credentials in the call.  Or do we need to somehow create or
own result type and if so how do we get those JSP results?  I have not
really found any good documentation or example on writing your own
result types.

Thanks in advance!



-
***Note:The information contained in this message may be privileged and
confidential and protected from disclosure. If the reader of this
message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, you
are hereby notified that any dissemination, distribution or copying of
this communication is strictly prohibited. If you have received this
communication in error, please notify the Sender immediately by replying
to the message and deleting it from your computer. Thank you. Premier
Inc.  

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



Re: [S2] Design Advice Needed

2007-08-02 Thread Oguz Kologlu
When I used XSLFO (maybe 3-4 years ago) it was really a pain. I can't  
see how it could have gotten any better - without a visual designer  
anyway.


Have a look at http://www.eclipse.org/birt (Birt) - It can generate  
PDF's, export data, has a good designer etc.


(also if you are thinking about using XML - XSL - PDF, Birt also  
supports XML Data sources as well as regular DB datasource, Scripted  
datasources etc.


HTH,
Oz

On 02/08/2007, at 10:35 PM, Wesley Wannemacher wrote:


Having used FOP briefly, I would add only one thing. It is generally
considered a good practice to generate traditional XML first, then
transform your data to XSLFO using a transform (pardon me if I am
getting the terms wrong). Basically, create your XML data, then  
have an

XSL file that transforms your data to FO, then use FOP to transform it
into a PDF.

I saw a few responses that seem to indicate you may choose Jasper,  
which

is likely a better idea anyways.

-Wes

-Original Message-
From: Hoying, Ken [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 02, 2007 7:40 AM
To: user@struts.apache.org
Subject: [S2] Design Advice Needed

I could use some advice from some folks with more experience and
knowledge of Struts2 than I to assist me in determining the correct  
way
(or lay out some viable options) to design a solution for the  
following

senario:

We need to generate a PDF report real time based on data in a database
that is available for download.  What we believe that we would like to
do is utilize FOP (http://xmlgraphics.apache.org/fop/) and use a JSP
page to actually generate the formatting objects and then run the
formatting objects through the FOP processor to generate and stream  
the

PDF back to the user.

However, we are not real sure how to implement this in Struts2.   
How do

we invoke the JSP page and then get access to the results?  Do we just
use the stream result type and then use a http call to the JSP as the
input source?  This would seem like it would not be optimal from a
performance standpoint, as we are making another http call to get the
formatting objects from the jsp.  It also adds the complexity of  
passing

security credentials in the call.  Or do we need to somehow create or
own result type and if so how do we get those JSP results?  I have not
really found any good documentation or example on writing your own
result types.

Thanks in advance!



-
***Note:The information contained in this message may be privileged  
and

confidential and protected from disclosure. If the reader of this
message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, you
are hereby notified that any dissemination, distribution or copying of
this communication is strictly prohibited. If you have received this
communication in error, please notify the Sender immediately by  
replying

to the message and deleting it from your computer. Thank you. Premier
Inc.

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





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