Skip to Content
author's profile photo Former Member
Former Member

Using Ant to pre compile jsp's

Hello,

I'm trying to compile my jsp's at build time using Ant. I'm familiar with how to do this with both weblogic and websphere but I cannot find any information on how to do this with the SAP j2ee engine. I know there is a way to have the server compile pages at startup but I want to be able to simply supply an ear with all of the compiled jsp's.

Thanks,

Chris

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 03, 2005 at 03:59 AM

    Hi Chris,

    In NDS (NetWeaver Developer Studio) you can create JSPs within Web Modle Project and include it into Enterprise Application Project and select the application project and right click it and select Build Application Archive, which will generate .ear file which will compiles all the classes and select the ear file and deploy it into the WAS (Web Application Server).

    Thanks

    Hari

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 03, 2005 at 12:46 PM

    Thank you for your reply.

    Unforunately, I will not be able to use NetWeaver to build the .ear file. I need to be able to build the .ear just using ant. Any other ideas?

    Thanks

    Chris

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 04, 2005 at 11:17 PM

    Try this -

    <jspc srcdir="$/src/war" destdir="$/gensrc"

    package="com.i3sp.jsp"

    compiler="jasper41"

    verbose="9">

    <include name="*/.jsp"/>

    </jspc>

    or check out all the ant tasks @ http://ant.apache.org/manual/

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 11, 2005 at 07:30 PM

    I thought that jsp's needed to be compiled specifically for each app server. Will jsp's compiled with the apache/tomcat jasper41 compiler run properly in the SAP J2EE server?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Based on Roger's reply, I ended up solving this issue.

      It's important when using jasper to precompile your jsp's to put jasper-runtime.jar in your WEB-INF/lib directory.

      in addition to the ant script he supplied, this other bit is helpful to automatically create the servlet entries for webxml and then insert them automatically

      In the jspc ant task, add the property "webinc" and give it the name of the xml fragment file.

      You need to have the text "@JSPC-INSERT-HERE@" in your base web.xml file...

      <loadfile property="jspc.webxml.fragment.contents" srcFile="${xml.fragment}"/>

      <copy file="$/web.xml" tofile="$/web.xml"/> <replace file="$/web.xml">

      <replacefilter token="@JSPC-INSERT-HERE@" value="${jspc.webxml.fragment.contents}"/>

      </replace>

      Thanks for the helpful responses.

      Chris

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.