cancel
Showing results for 
Search instead for 
Did you mean: 

Using Ant to pre compile jsp's

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

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?

Former Member
0 Kudos

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

Former Member
0 Kudos

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/

Former Member
0 Kudos

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

Former Member
0 Kudos

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