6 Replies Latest reply on Oct 9, 2002 11:34 AM by davotoula

    JSP Precompilation

    snumburi

      Hi

      I am trying to precompile the JSP to class files.
      When i used Jasper jspC its just coverting the jsp to .java.
      And also observed that when jsp is dynamically compiling at runtime the file name is $jsp.java but when precompiling its only .java ... Any body have an idea why like this...

      Help req to covert the jsp to .class

      Thanks
      satish

        • 1. Re: JSP Precompilation

          I have an item in my FAQ about JSP precompilation.

          If you are using Jasper2, you will probably find that all jsps with the same name, but different directories are thoughfully collapsed into a single package - i.e. it doesn't work. You should use Jasper1 if you experience this problem.

          If you are using Jasper1, this FAQ should be relevant.

          http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/contrib/jetty/FAQ?rev=HEAD&content-type=text/vnd.viewcvs-markup

          Jules

          • 2. Re: JSP Precompilation
            snumburi

            Hi Jules

            Thank much for your reply. I got the information in the links you provided.

            Have a good day..

            Satish

            • 3. Re: JSP Precompilation
              priti_ranka

              Hi Jules,

              I am struggling with the same problem of compiling jsps at time of deployment.
              I browsed through your FAQ but now in latest version of build.xml precompilation section is removed.

              I browsed thru jasper's source code and found that if jsp_precompile is present in Request then Jasper won't compile jsp.
              My problem is how to specify this PRECOMPILE option and where to specify the directory from where servlet classes are to be picked for corresp.?

              In weblogic we can specify in context_root element as a param_name=weblogic.jsp.precompile
              param_value=true

              Is there similar way in Jetty ?

              Looking forward for ur reply ...

              Regards,
              Priti



              • 4. Re: JSP Precompilation
                priti_ranka

                Hi Jules,

                I am struggling with the same problem of compiling jsps at time of deployment.
                I browsed through your FAQ but now in latest version of build.xml precompilation section is removed.

                I browsed thru jasper's source code and found that if jsp_precompile is present in Request then Jasper won't compile jsp.
                My problem is how to specify this PRECOMPILE option and where to specify the directory from where servlet classes are to be picked for corresp.?

                In weblogic we can specify in context_root element as a param_name=weblogic.jsp.precompile
                param_value=true

                Is there similar way in Jetty ?

                Looking forward for ur reply ...

                Regards,
                Priti



                • 5. Re: JSP Precompilation

                  There is no support for deployment-time JSP precompilation.

                  IMHO, compiling at deploy or run time is too late. The developer is out of the loop and if anything goes wrong a sysadmin is left holding the baby.

                  If I were to try to implement deployment-time compilation, I would simply be trying to do what the developer should be doing, but with less information.

                  I don't understand your point about a flag telling Jasper not to compile a JSP - how will it be run if not compiled ? You are talking about Requests - which are only present at runtime - so this is not an option for deployment-time.

                  Someone recently posted a solution that looks similar to yours, where they specified tags in their web.xml with jsp pages and the used <load-on-startup> to force precompilation at deployment time. Perhaps this is what you need ?

                  Hope that helps.


                  Jules

                  • 6. Re: JSP Precompilation
                    davotoula

                    Jules,

                    can you please provide a link to the article you mentioned or re-tell how to use the <load-on-startup> to precompile JSPs?

                    I have tried and JBoss is reporting that my JSPs are initiated but they are not compiled to /WEB-INF/ and there is no improvement in first hit access time.

                    thank you,
                    David