Re: Re: How to send excel files

Florin PATRASCU <[email protected]> Sat, 22 Nov 2003 15:24:24 -0400
Newsgroups gmane.comp.java.jpublish.devel
Message-ID <6.0.1.1.2.20031122145154.02005b48@POP>
Hi Herve,

There is an alternative, though :)

I am using a `path-action` to stream out an EXCEL file or whatever file you 
might need. I made for you a  30 minutes simple example: 
http://www.flop.ca/demo/jpexcel.zip (before trying it, please keep in mind 
that /WEB-INF/lib folder is empty, be sure you'll add there the jar 
libraries distributed together with standard JPublish package)

I am simply using an existing EXCEL file for the simplicity of this demo.

This is a *very* basic example, however you can imagine endless solutions: 
create on-fly file names in Velocity and intercept the calls, browse a 
non-existing directory with non-existing files ;) created by Actions. 
Actions will inject in Page Context the "folder/file" structures required 
to kid the User ;)...

JPublish offers you complete flexibility from this point of view. There are 
also pre and post evaluation Actions, again very useful if you know exactly 
your content work-flow, etc. ... and finally the solution you posted :)

Be sure you check JPublish demos, many questions are answered there already!

Cheers,
-Florin

At 20/11/2003 20:25, you wrote:
>I ended up doing this
>
>public class MyServlet extends jPublishServlet
>{
>...
>protected void doGet( request, response ) throws ServletException,
>{
>    String path = request.requestURI;
>    if ( path.endsWith( "/stream/file.xls" ) )
>    {
>       ... stream here
>    }
>    else
>    {
>       super.doGet( request, response );
>    }
>} // end doGet()
>}  // end class
>
>
>its not the most elegant way, but it works.
>
>
>
> > I just wanted to mention that the MultipartRequest
> > class from com.oreilly.servlet might be useful
> > as well:
> >
> > http://servlets.com/cos/javadoc/com/oreilly/servlet/MultipartRequest.html
> >
> > Hope that helps,
> >
> > James
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Free Pop-Up Blocker - Get it now
> > http://companion.yahoo.com/
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: SF.net Giveback Program.
> > Does SourceForge.net help you be more productive?  Does it
> > help you create better code?  SHARE THE LOVE, and help us help
> > YOU!  Click Here: http://sourceforge.net/donate/
> > _______________________________________________
> > Jpublish-developer mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/jpublish-developer
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: SF.net Giveback Program.
>Does SourceForge.net help you be more productive?  Does it
>help you create better code?  SHARE THE LOVE, and help us help
>YOU!  Click Here: http://sourceforge.net/donate/
>_______________________________________________
>Jpublish-developer mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jpublish-developer




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/