Hi Nicolas,

Thanks for your reply, I really appreciate your help. I'm not sure I
fully understand your solution. I see now that the webXmlFragment
provides a convenient way to generate the XML needed for the Servlets
but that have bizarre names.

Let's say I have a jsp:
/RichardsApp/DoSomething.jsp

Running Jasper at it provides a java file:
/RichardsApp/DoSomething_jsp.java

Then the Servlet definition would be:
<servlet>
  <servlet-name>RichardsApp.DoSomething_jsp</servlet-name>
  <servlet-class>RichardsApp.DoSomething_jsp</servlet-class>
</servlet>

The way to reference my JSP used to be:
http://myserver:8080/RichardsApp/DoSomething.jsp

What would the new reference be?
http://myserver:8080/RichardsApp/DoSomething_jsp
or
http://myserver:8080/RichardsApp/DoSomething

Have I missed something obvious?

Thanks for your help!
Richard.


-----Original Message-----
From: Karasek-XID, Nicolas [mailto:[EMAIL PROTECTED] 
Sent: 05 September 2005 12:04
To: Tomcat Users List
Subject: RE: Pre-compiled JSPs?

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:[EMAIL PROTECTED] 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to