Hi Richard,
 
I think I see your problem. If I understand correctly, survey.jsp produces html, not fo, but you have a stylesheet that transforms html to fo (I would love to get a copy of that stylesheet by the way--could be very useful).
 
There is a currently discussion on the developer's list to modify maverick to allow multiple transformations on a a single view, so eventually fop view will be converted to a custom transform and you will just have:
 
    <commands>
        <command name="fop">
            <controller class="FopTest"/>
            <view name="html" path="html.jsp"/>
            <view name="pdf" path="/jsp/survey.jsp">
                <transform type="xslt" path="html_to_fo.xsl"/>
                <transform type="fop"/>
            </view>
        </command>
 
Very clean and nice. However, since the multiple transform support is only in discussion right now on the developer's list, you will need to do things another way. The path parameter of the fop view can take another maverick command, so I would break it down into two commands:
 
The first command is the standard command that will be called by the user, so they would see on the command line:
 
 
        <command name="fop">
            <controller class="FopTest"/>
            <view name="html" path="html.jsp"/>
            <view name="pdf" type="fop" path="survey_fop.m"
        </command>
   
We are still stuck here at the second command. Basically we want something like:
 
        <command name="success_fop">
            <!--default controller that just returns success-->>
            <controller class="org.infohazard.maverick.ctl.ThrowawayBean"/>
            <view name="success" path="survey.jsp">
                <transform path "html_fo_fo.xsl"/>
    
        </view>
        </command>
 
where the command takes the output of a jsp and runs it through an xsl (in this case html_to_fo.jsp). Unfortunately I don't think there is currently a maverick view that supports that, so basically I can recommend two options: join the mav user mail list (http://sourceforge.net/mail/?group_id=26951) and post the question there--maybe one of the guys there knows of an existing way to do it, or the second option is to write your own custom view for maverick that does it (type jsp_xsl, as below):
 
        <command name="success_fop">
            <!--default controller that just returns success-->>
            <controller class="org.infohazard.maverick.ctl.ThrowawayBean"/>
            <view name="success" type="jsp_xsl" path="survey.jsp">
                <transform path "html_fo_fo.xsl"/>
    
        </view>
        </command>
 
There is already an xsl transform view for maverick (opt-domify on the sourceforge downloads page), and my fop view does much of what you need, so between those two sources, you should be able to hobble something together.
 
Sorry I don't have an easier answer. The good news is that hopefully in 5 or 6 weeks, the multiple transforms functionality will be there and this will no longer be an issue, but I am guessing you don't have 5 or 6 weeks to wait (though you could always joing the user list and pressure Jeff and Scott, the lead developers on maverick, and maybe they could whip something up sooner).
 
--jim 
 
 
 
----- Original Message -----
Sent: Monday, June 03, 2002 6:34 PM
Subject: RE: [iText-questions] Branching my JSP output: HTM (to view data) or PDF(to print)

Hello Jim,

I wonder if I can bug you again about the files you provided me. I spent the weekend studing the Maverick API and documentation and java files. It isn't clear to me how I can use this in my application. Perhaps you can point me in the right direction.

To summarize I am using a jsp that contains several layers of included jsp pages which together display data from a database. It is using https and there is a login feature. My assignment is to find a way for users to grab a desired page of data and display it in a pdf file for printing and distribution. Your program seems to be close to the solution I am seeking however I haven't been able to figure out how to plug it into my application.

A typical call to the app is

 http://localhost:8100//jsp/survey.jsp?action=selectSection&sectionName=Program+Volume+by+Diagnosis&sectionId=36&sectionStatus=set

As you can see, parameters are passsed to survey.jsp that displays a header, footer, left navigation menu and main data page via tables, text boxes, etc. I would like to grab the page as it displays, just as your FopView.java code does. I have a style sheet called html_to_fo.xsl. Do I need to pass my parameters some other way and do this:

<?xml version="1.0" ?>
<maverick version="2.0" default-view-type="document" default-transform-type="document">
    <modules>
        <view-factory type="fop" provider="org.infohazard.maverick.opt.view.FopViewFactory"/>
    </modules>

    <commands>
        <command name="fop">
            <controller class="FopTest"/>
            <view name="html" path="html.jsp"/>
            <view name="pdf" type="fop" path="/jsp/survey.jsp"
                <transform type="xslt" path="html_to_fo.xsl"/>
            </view>
        </command>
    </commands>
</maverick>

Any suggestions or pointers you can provide would be greatly appreciated.
Thanks in advance Jim.
Richard










To: "'Richard Elsberry'" <[EMAIL PROTECTED]>
Subject: RE: [iText-questions] Branching my  JSP output: HTM (to view   data) or PDF(to print)


Hi Richard,


My first guess is that you must be using jdk1.3. I'm using 1.4, so the
xml api's are built in. If you are using 1.3 they need to be in the
classpath. Put the attached xml-apis.jar file in
C:\tomcat\webapps\opt-fop\WEB-INF\lib, then restart tomcat.


I think this should fix it (I've had this problem myself a couple of
times).


--jim


-----Original Message-----
From: Richard Elsberry [mailto:[EMAIL PROTECTED]]
Sent: Sunday, May 26, 2002 12:54 PM
To: jim moore
Subject: Re: [iText-questions] Branching my JSP output: HTM (to view
data) or PDF(to print)



Hi Jim,


I had a problem running the application After downloading the latest
version of Tomcat the app unpacked fine however
I get a Servlet dispatcher is currently unavailable error message. The
maverick.xml
and web.xml files are located in C:\tomcat\webapps\opt-fop\WEB-INF and,
along with the rest of the jar files, the
maverick.jar  file is located in C:\tomcat\webapps\opt-fop\WEB-INF\lib.
Everything in maverick.xml and web.xml
seems to be mapped correctly so I am stumped. Any thoughts about this?


Thanks, Richard



At 05:02 PM 5/24/2002 -0400, you wrote:


no problem. Incidentally, even if you don't end up using Maverick and
fop,
take a look at the source for org.infohazard.maverick.opt.view.FopView
(under WEB-INF/src). That is where I am doing the jsp output trapping
which
you mentioned was one of your problems. The real grunt work here is
actually
done by org.infohazard.maverick.util.FakeHttpServletResponse. It is
included
in maverick.jar, but if you want to the see the source for it, you can
get
it at mav.sourceforge.net.


good luck,
--jim


----- Original Message -----
From: "Richard Elsberry" <[EMAIL PROTECTED]>
To: "jim moore" <[EMAIL PROTECTED]>
Sent: Friday, May 24, 2002 4:40 PM
Subject: Re: [iText-questions] Branching my JSP output: HTM (to view
data)
or PDF(to print)



> Thanks Jim, I've downloaded the war file and am going to take a look
at it
> tonight. I've been
> trying to solve this problem for some time so I am quite anxious to
take a
> look. I'll write
> you back and let you know how it works out for me.
> best regards, Richard
>
> At 12:17 PM 5/24/2002 -0400, you wrote:
> >Hi Richard,
> >
> >I'm sending this offlist because I solved this same problem using fop
> >(xml.apache.org/fop) and maverick (mav.sourceforge.net), not iText,
so I
> >don't want to start a flame war. Not that iText isn't great--I wrote
the
> >PdfGraphics2D that is now part of the standard iText distribution--I
just
> >found that it wasn't the best solution for this problem.
> >
> >Maverick is an MVC (model view controller) framework. Most
importantly,
it
> >lets you deliver the same request to different views--in this case
when
an
> >html is requested, simply send it to a normal jsp page. When a pdf is
> >requested, use a custom maverick view I created to run a jsp that
creates
an
> >fo stylesheet that fop can process, and send the output of the fop
> >transformation (a pdf) to the user.
> >
> >I've created a sample war file if you want to play around with it.
It's
> >about 4.5mb because of all the required jars, so I'm not attaching it
to
> >this email. You can download it at
http://www.scolamoore.com/opt-fop.war
> >
> >You'll need a servlet 2.3 spec app server to run it because of the
request
> >wrapping needed to trap the jsp output. I use tomcat 4. If you're
using
> >tomcat 4, just drop the war file into your web-apps folder and
restart
> >tomcat.
> >
> >--jim
> >
> >----- Original Message -----
> >From: "Richard Elsberry" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Friday, May 24, 2002 10:27 AM
> >Subject: [iText-questions] Branching my JSP output: HTM (to view
data) or
> >PDF(to print)
> >
> >
> > > Hello,
> > >
> > > I've been experimenting with iText for about 4 days and have come
close
> > > to my solution but keep getting stumped. I have a web page that
displays
> > > database info and I want to have the option for users to generate
a
pdf
> > > version if needed. I am using Java and there are two places where
I
keep
> > > getting stuck::
> > >
> > > 1. GRAB THE HTML THAT THE JSP GENERATES ON THE FLY
> > > - have tried  a URLConnection (problems with re-login here)
> > > - playing with a custom tag that incases the page then saving it
to a
> > > string using the doAfterBody() method. This hasen't been working
too
> > > well. The jsp has several layers of includes and may be too
complex
for
> > > this.
> > >
> > > 2. CONVERT THE HTML TO A ITEXT DOCUMENT
> > > -Once I grap the html, how do I convert the HTML that the JSP
creates
> > > over to an iText Document object so that I can use the PDFWriter
to
> > > write it out as a ByteArrayOutputStream. I am still searching the
> > > archives and using the tutorial provided.
> > >
> > > Has anybody had to develop a similar solution. It seems like this
would
> > > be a common need. Perhaps I am approachng this the wrong way or
don't
> > > understand iText enough yet.
> > >
> > > Any input would be GREATLY appleciated.
> > >
> > > Thanks, Richard
> > >
> > >
> > > _______________________________________________________________
> > >
> > > Don't miss the 2002 Sprint PCS Application Developer's Conference
> > > August 25-28 in Las Vegas --
http://devcon.sprintpcs.com/adp/index.cfm
> > >
> > > _______________________________________________
> > > iText-questions mailing list
> > > [EMAIL PROTECTED]
> > > https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Richard Elsberry
> [EMAIL PROTECTED]
> 651-222-4393
>
Richard Elsberry
[EMAIL PROTECTED]
651-222-4393


 xml-apis.jar 

Reply via email to