tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karasek-XID, Nicolas" <n-kara...@ti.com>
Subject RE: Pre-compiled JSPs?
Date Mon, 05 Sep 2005 11:04:13 GMT
Hi,

You need to insert in your web.xml the reference to the precompiled
servlets. Jasper can generate a web.xml fragment when turning JSP into
servlets. You can then insert the fragment into your web.xml
Something like this with ant:

<!-- turn jsp into servlets -->
<jasper2 verbose="0"
	package="your.package"
	validateXml="false"
	uriroot="${webapp.path}"
	webXmlFragment="generated-web.xml"
	outputDir="${webapp.path}/WEB-INF/src" />

<!-- Load the precompiled snippet into a property -->
<loadfile property="precompiled"
	srcFile=" generated-web.xml"
	encoding="ISO-8859-1" />

<!-- Now replace the web.xml with a predefined snippet -->
<!-- copy web.xml -->
<replace file="web.xml" value="${precompiled}">
<replacetoken>&lt;!-- jsp-servlets will be inserted here - do not remove
this line --&gt;</replacetoken>
</replace>



-----Original Message-----
From: Richard Burman [mailto:richard.burman@ardentia.co.uk] 
Sent: lundi 5 septembre 2005 12:44
To: Tomcat Users List
Subject: Pre-compiled JSPs?

Hi everyone,

I have a fairly elaborate problem but hope that some people out there
can help with it.

I am trying to take a large webapp and create pre-compiled JSPs. We
already compile the java into class files, then package in JARs, then
finally a WAR, but we would like to be able to package the JSPs into a
neat package, too.

The first hurdle was trying to circumvent the issue of when JSPs include
each other and a bean is used in both JSPs but can only be declared once
when the JSPs are combined. Thus, you have to leave out the bean
declaration in the second JSP but then it will not compile on it's own
because it has no knowledge of the bean. Fortunately, in the recent
Tomcat releases, it's possible to use the flag
'errorOnUseBeanInvalidClassAttribute' to ignore this problem.

Once the JSPs have been turned into Java classes by Jasper2, it's not
too hard to compile them into class files. But how do you deploy these
compiled classes so that Tomcat knows to use them? If the Whatever.jsp
file doesn't exist, how does Tomcat know where or how to find the
compiled JSP file? Should I put them in a JAR and deploy somewhere? Do I
need to change the web.xml or similar to inform Tomcat about this?

If anyone has any suggestions, advice or solutions to this, I would be
eternally grateful! :)

Thanks,
Richard.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message