RE: Pre-compiled JSPs?

2005-09-07 Thread Richard Burman
Hi Tim,

Sorry, I'm sure I'm being a bit dense but I seem to be missing something
important here.

Are the jspf files included (embedded) into the class file when Jasper
compiles the jsp files to java? Essentially, the compiled class file
will include the original jsp and also the fragment?

Thanks for your help!

Richard.

-Original Message-
From: Tim Funk [mailto:[EMAIL PROTECTED] 
Sent: 06 September 2005 17:01
To: Tomcat Users List
Subject: Re: Pre-compiled JSPs?

There is no need to turn jspf into classes. The jspf are included by
real jsp 
files. Those jsp files are turned into the class files.

-Tim

Richard Burman wrote:

 Tim,
 
 Is there no way of turning the fragment (jspf) file into .class files
or
 do they need to remain as JSPs?
 
 Cheers,
 Richard.
 
 -Original Message-
 From: Tim Funk [mailto:[EMAIL PROTECTED] 
 Sent: 06 September 2005 16:14
 To: Tomcat Users List
 Subject: Re: Pre-compiled JSPs?
 
  From the jasper task all the [valid] jsp's are turned into java files
 and 
 compiled into class files. Those class files need to be a jar file in 
 WEB-INF/lib or inside WEB-INF/classes. The jasper task can also
rewrite 
 web.xml so that all the mappings from the JSP -- class file are taken
 care of.
 
 Once all the jsp's are compiled and mapped in web.xml. They can be
 deleted 
 from the deployment war file (or dir).
 
 
 -Tim
 
 Richard Burman wrote:
 
 
Hi Tim,

Yeah, that's my exact issue, except the pages somewhat more
 
 complicated
 
than your example. ;o)

I've tried renaming one of them to jspf and, unsurprisingly, it has
 
 been
 
ignored by the JSP compiler. I'll have to take your word that it would
still work in the parent (once the reference had been changed to point
to jspf, not jsp) as I don't have a test bed up and running at the
moment.

Okay, so we've ascertained how to avoid the 'fragments' being compiled
because they're effectively not valid JSP pages because they use beans
that are never declared within themselves. The 'parent' page will
compile because it has all it needs to be compiled but the fragment
cannot be compiled without the presence of the parent. Does this mean
that I can only include the 'parent' JSPs in my JAR file and included
 
 in
 
my web.xml? Do I have to keep the fragments as raw JSPs in my webapp,
then? I'd really rather get them all together in a JAR, if possible,
which is why I'm on this voyage of discovery! :o)


-
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]



Re: Pre-compiled JSPs?

2005-09-07 Thread Tim Funk
Yes, think of jspf like .h files in c. You don't compile .h files, but .c 
files include .h files at compile time.


-Tim

Richard Burman wrote:


Hi Tim,

Sorry, I'm sure I'm being a bit dense but I seem to be missing something
important here.

Are the jspf files included (embedded) into the class file when Jasper
compiles the jsp files to java? Essentially, the compiled class file
will include the original jsp and also the fragment?
 


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



RE: Pre-compiled JSPs? - Solved. Thanks!

2005-09-07 Thread Richard Burman
Right, I get it now. Thanks for all your help Tim, Darryl and Nicolas!

Happy Tomcat-ing,
Richard.

-Original Message-
From: Tim Funk [mailto:[EMAIL PROTECTED] 
Sent: 07 September 2005 12:15
To: Tomcat Users List
Subject: Re: Pre-compiled JSPs?

Yes, think of jspf like .h files in c. You don't compile .h files, but
.c 
files include .h files at compile time.

-Tim

Richard Burman wrote:

 Hi Tim,
 
 Sorry, I'm sure I'm being a bit dense but I seem to be missing
something
 important here.
 
 Are the jspf files included (embedded) into the class file when Jasper
 compiles the jsp files to java? Essentially, the compiled class file
 will include the original jsp and also the fragment?
  

-
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]



RE: Pre-compiled JSPs?

2005-09-06 Thread Richard Burman
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-nameRichardsApp.DoSomething_jsp/servlet-name
  servlet-classRichardsApp.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}
replacetokenlt;!-- 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]



Re: Pre-compiled JSPs?

2005-09-06 Thread Darryl L. Miles


What you see looks like normal jasper name mangling of generated pages.

You use: http://myserver:8080/RichardsApp/DoSomething.jsp


I presume there is also a generated mapping entry, that you may have 
overlooked:


servlet-mapping
 servlet-nameRichardsApp.DoSomething_jsp/servlet-name
 url-pattern/DoSomething.jsp/url-pattern
/servlet-mapping

Richard Burman wrote:


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-nameRichardsApp.DoSomething_jsp/servlet-name
 servlet-classRichardsApp.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.
 



--
Darryl L. Miles



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



RE: Pre-compiled JSPs?

2005-09-06 Thread Richard Burman
Eureka! I get it now. :)

Indeed, I hadn't noticed the servlet-mapping section down the bottom. I
looked at the xml and foolishly assumed that it merely repeated all the
way to the bottom. Now that you've pointed out that, it all makes sense.

Thanks for all your help, I shall have a play and hopefully have new,
sparkly, compiled JSPs soon!

Richard.

-Original Message-
From: Darryl L. Miles [mailto:[EMAIL PROTECTED] 
Sent: 06 September 2005 12:33
To: Tomcat Users List
Subject: Re: Pre-compiled JSPs?


What you see looks like normal jasper name mangling of generated pages.

You use: http://myserver:8080/RichardsApp/DoSomething.jsp


I presume there is also a generated mapping entry, that you may have 
overlooked:

servlet-mapping
  servlet-nameRichardsApp.DoSomething_jsp/servlet-name
  url-pattern/DoSomething.jsp/url-pattern
/servlet-mapping

Richard Burman wrote:

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-nameRichardsApp.DoSomething_jsp/servlet-name
  servlet-classRichardsApp.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.
  


-- 
Darryl L. Miles



-
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]



RE: Pre-compiled JSPs?

2005-09-06 Thread Richard Burman
Ah, I thought it was all too good to be true. Now that I have an
understanding of how to put it all together, I have given it a go but
hit another snag.

Remember the use of the 'errorOnUseBeanInvalidClassAttribute' flag?
Well, of course, that means that when the JSPs were turned into Java
classes, they ignored the fact that the bean wasn't declared in that JSP
and generated the classes regardless. What about when you try to compile
the Java into a .class file? Suddenly, the Java is missing a variable
declaration and cannot compile the class. Is there a way round this? If
not, what's the point in including the flag?!

Yours,
Confused of UK. ;o)

-Original Message-
From: Richard Burman [mailto:[EMAIL PROTECTED] 
Sent: 06 September 2005 13:50
To: Tomcat Users List
Subject: RE: Pre-compiled JSPs?

Eureka! I get it now. :)

Indeed, I hadn't noticed the servlet-mapping section down the bottom. I
looked at the xml and foolishly assumed that it merely repeated all the
way to the bottom. Now that you've pointed out that, it all makes sense.

Thanks for all your help, I shall have a play and hopefully have new,
sparkly, compiled JSPs soon!

Richard.

-Original Message-
From: Darryl L. Miles [mailto:[EMAIL PROTECTED] 
Sent: 06 September 2005 12:33
To: Tomcat Users List
Subject: Re: Pre-compiled JSPs?


What you see looks like normal jasper name mangling of generated pages.

You use: http://myserver:8080/RichardsApp/DoSomething.jsp


I presume there is also a generated mapping entry, that you may have 
overlooked:

servlet-mapping
  servlet-nameRichardsApp.DoSomething_jsp/servlet-name
  url-pattern/DoSomething.jsp/url-pattern
/servlet-mapping

Richard Burman wrote:

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-nameRichardsApp.DoSomething_jsp/servlet-name
  servlet-classRichardsApp.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.
  


-- 
Darryl L. Miles



-
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]



Re: Pre-compiled JSPs?

2005-09-06 Thread Tim Funk
errorOnUseBeanInvalidClassAttribute (IIRC) is a test when jsp:useBean is used 
without a default constructor being available.


If you are using include files which were as meant as compile time include 
fragments, rename them (the include files) to jspf and they will be ignored 
by the jsp compiler.


-Tim

Richard Burman wrote:


Ah, I thought it was all too good to be true. Now that I have an
understanding of how to put it all together, I have given it a go but
hit another snag.

Remember the use of the 'errorOnUseBeanInvalidClassAttribute' flag?
Well, of course, that means that when the JSPs were turned into Java
classes, they ignored the fact that the bean wasn't declared in that JSP
and generated the classes regardless. What about when you try to compile
the Java into a .class file? Suddenly, the Java is missing a variable
declaration and cannot compile the class. Is there a way round this? If
not, what's the point in including the flag?!
 


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



RE: Pre-compiled JSPs?

2005-09-06 Thread Richard Burman
Sorry, I don't understand. How will my JSP compile at all if a section
(fragment) is ignored and, presumably, omitted from the resulting java
file?

-Original Message-
From: Tim Funk [mailto:[EMAIL PROTECTED] 
Sent: 06 September 2005 15:05
To: Tomcat Users List
Subject: Re: Pre-compiled JSPs?

errorOnUseBeanInvalidClassAttribute (IIRC) is a test when jsp:useBean is
used 
without a default constructor being available.

If you are using include files which were as meant as compile time
include 
fragments, rename them (the include files) to jspf and they will be
ignored 
by the jsp compiler.

-Tim

Richard Burman wrote:

 Ah, I thought it was all too good to be true. Now that I have an
 understanding of how to put it all together, I have given it a go but
 hit another snag.
 
 Remember the use of the 'errorOnUseBeanInvalidClassAttribute' flag?
 Well, of course, that means that when the JSPs were turned into Java
 classes, they ignored the fact that the bean wasn't declared in that
JSP
 and generated the classes regardless. What about when you try to
compile
 the Java into a .class file? Suddenly, the Java is missing a variable
 declaration and cannot compile the class. Is there a way round this?
If
 not, what's the point in including the flag?!
  

-
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]



Re: Pre-compiled JSPs?

2005-09-06 Thread Tim Funk

For example:

File a.jsp
% String worldVar = null; %
[EMAIL PROTECTED] file='b.jsp'%
Hello  %=worldVar%

File b.jsp
%worldVar = world%


Notice b.jsp will not precompile. But then again - no one should be calling 
b.jsp since its not a jsp - its a jsp fragment. It should be calld b.jspf.


I am guessing - your pages have a similar issue.

-Tim


Richard Burman wrote:


Sorry, I don't understand. How will my JSP compile at all if a section
(fragment) is ignored and, presumably, omitted from the resulting java
file?

-Original Message-
From: Tim Funk [mailto:[EMAIL PROTECTED] 
Sent: 06 September 2005 15:05

To: Tomcat Users List
Subject: Re: Pre-compiled JSPs?

errorOnUseBeanInvalidClassAttribute (IIRC) is a test when jsp:useBean is
used 
without a default constructor being available.


If you are using include files which were as meant as compile time
include 
fragments, rename them (the include files) to jspf and they will be
ignored 
by the jsp compiler.


-Tim




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



RE: Pre-compiled JSPs?

2005-09-06 Thread Richard Burman
Hi Tim,

Yeah, that's my exact issue, except the pages somewhat more complicated
than your example. ;o)

I've tried renaming one of them to jspf and, unsurprisingly, it has been
ignored by the JSP compiler. I'll have to take your word that it would
still work in the parent (once the reference had been changed to point
to jspf, not jsp) as I don't have a test bed up and running at the
moment.

Okay, so we've ascertained how to avoid the 'fragments' being compiled
because they're effectively not valid JSP pages because they use beans
that are never declared within themselves. The 'parent' page will
compile because it has all it needs to be compiled but the fragment
cannot be compiled without the presence of the parent. Does this mean
that I can only include the 'parent' JSPs in my JAR file and included in
my web.xml? Do I have to keep the fragments as raw JSPs in my webapp,
then? I'd really rather get them all together in a JAR, if possible,
which is why I'm on this voyage of discovery! :o)

I really appreciate your help with this.

Regards,
Richard.

-Original Message-
From: Tim Funk [mailto:[EMAIL PROTECTED] 
Sent: 06 September 2005 15:57
To: Tomcat Users List
Subject: Re: Pre-compiled JSPs?

For example:

File a.jsp
% String worldVar = null; %
[EMAIL PROTECTED] file='b.jsp'%
Hello  %=worldVar%

File b.jsp
%worldVar = world%


Notice b.jsp will not precompile. But then again - no one should be
calling 
b.jsp since its not a jsp - its a jsp fragment. It should be calld
b.jspf.

I am guessing - your pages have a similar issue.

-Tim


Richard Burman wrote:

 Sorry, I don't understand. How will my JSP compile at all if a section
 (fragment) is ignored and, presumably, omitted from the resulting java
 file?
 
 -Original Message-
 From: Tim Funk [mailto:[EMAIL PROTECTED] 
 Sent: 06 September 2005 15:05
 To: Tomcat Users List
 Subject: Re: Pre-compiled JSPs?
 
 errorOnUseBeanInvalidClassAttribute (IIRC) is a test when jsp:useBean
is
 used 
 without a default constructor being available.
 
 If you are using include files which were as meant as compile time
 include 
 fragments, rename them (the include files) to jspf and they will be
 ignored 
 by the jsp compiler.
 
 -Tim
 


-
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]



Re: Pre-compiled JSPs?

2005-09-06 Thread Tim Funk
From the jasper task all the [valid] jsp's are turned into java files and 
compiled into class files. Those class files need to be a jar file in 
WEB-INF/lib or inside WEB-INF/classes. The jasper task can also rewrite 
web.xml so that all the mappings from the JSP -- class file are taken care of.


Once all the jsp's are compiled and mapped in web.xml. They can be deleted 
from the deployment war file (or dir).



-Tim

Richard Burman wrote:


Hi Tim,

Yeah, that's my exact issue, except the pages somewhat more complicated
than your example. ;o)

I've tried renaming one of them to jspf and, unsurprisingly, it has been
ignored by the JSP compiler. I'll have to take your word that it would
still work in the parent (once the reference had been changed to point
to jspf, not jsp) as I don't have a test bed up and running at the
moment.

Okay, so we've ascertained how to avoid the 'fragments' being compiled
because they're effectively not valid JSP pages because they use beans
that are never declared within themselves. The 'parent' page will
compile because it has all it needs to be compiled but the fragment
cannot be compiled without the presence of the parent. Does this mean
that I can only include the 'parent' JSPs in my JAR file and included in
my web.xml? Do I have to keep the fragments as raw JSPs in my webapp,
then? I'd really rather get them all together in a JAR, if possible,
which is why I'm on this voyage of discovery! :o)



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



RE: Pre-compiled JSPs?

2005-09-06 Thread Richard Burman
Tim,

Is there no way of turning the fragment (jspf) file into .class files or
do they need to remain as JSPs?

Cheers,
Richard.

-Original Message-
From: Tim Funk [mailto:[EMAIL PROTECTED] 
Sent: 06 September 2005 16:14
To: Tomcat Users List
Subject: Re: Pre-compiled JSPs?

 From the jasper task all the [valid] jsp's are turned into java files
and 
compiled into class files. Those class files need to be a jar file in 
WEB-INF/lib or inside WEB-INF/classes. The jasper task can also rewrite 
web.xml so that all the mappings from the JSP -- class file are taken
care of.

Once all the jsp's are compiled and mapped in web.xml. They can be
deleted 
from the deployment war file (or dir).


-Tim

Richard Burman wrote:

 Hi Tim,
 
 Yeah, that's my exact issue, except the pages somewhat more
complicated
 than your example. ;o)
 
 I've tried renaming one of them to jspf and, unsurprisingly, it has
been
 ignored by the JSP compiler. I'll have to take your word that it would
 still work in the parent (once the reference had been changed to point
 to jspf, not jsp) as I don't have a test bed up and running at the
 moment.
 
 Okay, so we've ascertained how to avoid the 'fragments' being compiled
 because they're effectively not valid JSP pages because they use beans
 that are never declared within themselves. The 'parent' page will
 compile because it has all it needs to be compiled but the fragment
 cannot be compiled without the presence of the parent. Does this mean
 that I can only include the 'parent' JSPs in my JAR file and included
in
 my web.xml? Do I have to keep the fragments as raw JSPs in my webapp,
 then? I'd really rather get them all together in a JAR, if possible,
 which is why I'm on this voyage of discovery! :o)
 

-
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]



Re: Pre-compiled JSPs?

2005-09-06 Thread Tim Funk
There is no need to turn jspf into classes. The jspf are included by real jsp 
files. Those jsp files are turned into the class files.


-Tim

Richard Burman wrote:


Tim,

Is there no way of turning the fragment (jspf) file into .class files or
do they need to remain as JSPs?

Cheers,
Richard.

-Original Message-
From: Tim Funk [mailto:[EMAIL PROTECTED] 
Sent: 06 September 2005 16:14

To: Tomcat Users List
Subject: Re: Pre-compiled JSPs?

 From the jasper task all the [valid] jsp's are turned into java files
and 
compiled into class files. Those class files need to be a jar file in 
WEB-INF/lib or inside WEB-INF/classes. The jasper task can also rewrite 
web.xml so that all the mappings from the JSP -- class file are taken

care of.

Once all the jsp's are compiled and mapped in web.xml. They can be
deleted 
from the deployment war file (or dir).



-Tim

Richard Burman wrote:



Hi Tim,

Yeah, that's my exact issue, except the pages somewhat more


complicated


than your example. ;o)

I've tried renaming one of them to jspf and, unsurprisingly, it has


been


ignored by the JSP compiler. I'll have to take your word that it would
still work in the parent (once the reference had been changed to point
to jspf, not jsp) as I don't have a test bed up and running at the
moment.

Okay, so we've ascertained how to avoid the 'fragments' being compiled
because they're effectively not valid JSP pages because they use beans
that are never declared within themselves. The 'parent' page will
compile because it has all it needs to be compiled but the fragment
cannot be compiled without the presence of the parent. Does this mean
that I can only include the 'parent' JSPs in my JAR file and included


in


my web.xml? Do I have to keep the fragments as raw JSPs in my webapp,
then? I'd really rather get them all together in a JAR, if possible,
which is why I'm on this voyage of discovery! :o)



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



RE: Pre-compiled JSPs?

2005-09-05 Thread Karasek-XID, Nicolas
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}
replacetokenlt;!-- 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]