4 Replies Latest reply on May 19, 2004 8:24 PM by maccoy

    How to save JSP Page to Excel w/ JBoss 3.2.2. Help pls...

    maccoy

      Does anyone tried to have a JSP page saved to excel? Im using JBoss 3.2.2. I have a JSP page and I want to save it to excel. Im using --

      <%@ page contentType="application/vnd.ms-excel" %> --

      but still it won't work. Any ideas?

      macooy

        • 1. Re: How to save JSP Page to Excel w/ JBoss 3.2.2. Help pls..
          maccoy

           

          "maccoy" wrote:
          Does anyone tried to have a JSP page saved to excel? Im using JBoss 3.2.2. I have a JSP page and I want to save it to excel. Im using --

          <%@ page contentType="application/vnd.ms-excel" %> --

          but still it won't work. Any ideas?

          maccoy


          • 2. Re: How to save JSP Page to Excel w/ JBoss 3.2.2. Help pls..
            tomyeh

            ContentType is correct, but there are some other things that you have to take care, such as

            Buffer Issue. JSP is template-based and it outputs every it doesn't recoginized (such as whitespaces). So, you have to clear buffer at the end with <%out.clear();%>. Of course, it means you have to send output by yourself (in one of your custom tag).

            • 3. Re: How to save JSP Page to Excel w/ JBoss 3.2.2. Help pls..
              jonlee

              Also ensure that you set the content type before any output has been generated by the JSP. That is; there cannot be any out.print() or out.println() statements before the response.setContentType() statement - the JSP tag should translate to this setContentType method call. Check the generated Java source file to ensure that you have dealt with the situation - some people format the JSP code so that everything looks well-spaced but introduce characters to the actual output (HTTP) stream. Once characters are injected into the stream, you generally cannot change the content type of the stream.

              We often do the following for Excel-type output:

              response.setContentType("application/vnd.ms-excel");
              response.setHeader("Content-Disposition","inline;filename=result.csv");

              Hope that helps.

              • 4. Re: How to save JSP Page to Excel w/ JBoss 3.2.2. Help pls..
                maccoy

                hello guys!

                M sori it took a while for me to check and test your ideas. I've been out of office for almost a month, I had a short vacation and after a training. Anyway, can you give me (if possible) a sample code. Should I issue clear buffer every end of the line? How would I assure that the content type of my generated java source file has been set successfully. I tried some of your scripts, still I wasn't to get my desired result. Are there any necessary configurations neede at JBoss for this matter?

                Thanks.

                maccoy