Re: Re: How to send excel files
Florin PATRASCU <[email protected]> Sun, 23 Nov 2003 12:42:31 -0400
| Newsgroups | gmane.comp.java.jpublish.devel |
|---|---|
| Message-ID | <6.0.1.1.2.20031123123708.0209b508@POP> |
Hi,
A JPublish user, trying to run the demo, complained about the following error:
HTTP Status 404 -
E:\jboss\server\default\deploy\jpexcel.war\static\demo.xls (The system
cannot find the path specified)
I was using an absolute path to my pre-generated EXCEL file, sorry guys. I
replaced the absolute path with a relative to `static` repository one:
...
SiteContext site = (SiteContext) context.get("site");
in = new FileInputStream( new File( site.getContextRoot(),
site.getStaticRoot()+"/demo.xls"));
...
You can grab the new .zip file if you want :)
I am glad you found this simple demo useful, thanks!
Later,
-Florin
At 22/11/2003 15:24, you wrote:
>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/
>_______________________________________________
>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/