Re: dynamically compile JSPs

2005-01-12 Thread Matt Bathje
So it looks like I need to send in classpath and destination directory 
configuration stuff to the JspC task (using setClassPath and 
setOutputDir on antTask I think)

Where do I get the proper information from though? (The proper 
information to me means the same classpath and output directory that 
tomcats jasper servlet uses) Is there a way to read the jasper servlets 
configuration variables in my serlvet? Of can I figure it out from the 
JspC(and related) source code? I haven't seen anything helpful there yet.


Hey all - replying to myself yet again. I got this working now, it 
parses and compiles the JSP file to the proper directory under 
TOMCAT_HOME/work/

Now - I have another problem - there are 2 types of files that I do this 
with. They both wind up being Struts/Tiles layout files, just in 
different directories basically.

When I upload/compile to one of the directories, it works perfectly for 
me - the JSP file is parsed and compiled, and when I view the pages the 
changes are properly reflected.

In the other directory, it parses/compiles the uploaded JSP page, but 
for some reason Tomcat never displays the updated JSP page until I 
restart the server. There is nothing special about this directory that I 
know of, it is just the parent directory of the one that is actually 
working.

Any idea how to fix that little problem? I was looking through the JspC 
code, and it looks like it reloads the JSP Servlet after a compile is 
done -but I'm not sure that would fix my problem (and as far as I know, 
there is no way to set JSPServletWrapper.reload to true from my serlvet.)

Any ideas on this last problem would be greatly appreciated.
Thanks,
Matt
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: dynamically compile JSPs

2005-01-11 Thread Matt Bathje
I was messing around with the code a little bit, and tried this:
JspC antTask = new JspC();
antTask.setArgs(new String[] { -compile, uploadTileFilePath });
antTask.execute();
but this always gave me an error that javax.servlet package could not be 
found.


Replying to myself here - but I got a bit further with this and need 
more support if anybody has any ideas.

I thought at first that this code would parse/compile the uploaded JSP 
page using the same paths/classpath/etc. that the Jasper servlet setup 
in web.xml uses.

It turns out I am wrong and it seems like it is using some sort of 
default for the classpath and output directory.

The classpath just has the classes from the jars for my local site 
(hence no tomcat jars and there error being seen above.

It is outputting the jsp file to a .java file under 
TOMCAT_HOME\org\apache\jsp\WEB_INF\tiles\public_\file_jsp.java (and 
presumably if I could get compilation to work it would compile to that 
directory as well.)

So it looks like I need to send in classpath and destination directory 
configuration stuff to the JspC task (using setClassPath and 
setOutputDir on antTask I think)

Where do I get the proper information from though? (The proper 
information to me means the same classpath and output directory that 
tomcats jasper servlet uses) Is there a way to read the jasper servlets 
configuration variables in my serlvet? Of can I figure it out from the 
JspC(and related) source code? I haven't seen anything helpful there yet.

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


Re: dynamically compile JSPs

2005-01-10 Thread Matt Bathje
[EMAIL PROTECTED] wrote:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper/docs/api/index.html
Usage of the JspC class.  This should be what you want.
I work in Windows 95% of the time, and I'm a simplicity freak, so I tend do do 
things, most of the time, with batch files called from UltraEdit.  Anyway, this 
is relevant because one of the steps in my typical build process is a 
compilation of all JSP's.  I use this class to do that.  I can give you the two 
lines from my batch file that does this if it would be helpful, but I tend to 
think the javadocs will get you where you want to go.


This is kind of an old thread I'm replying to - but I implemented what I 
thought would work for this, and haven't been able to get anything 
working reliably. As a refresher, the scenario is this:
- a Tomcat 5.0.x server with Jasper setup in development=false mode
- I upload a jsp page through a web interface, and want it to be 
compiled/usable immediately, instead of waiting for the scheduled jasper 
compilation
- putting ?jsp_compile=true on the page doesn't seem to work
- making development=true isn't an option

After looking through the JspC documentation a little bit, I tried this 
code in my class after the JSP file is uploaded:

JspC antTask = new JspC();
antTask.setArgs(new String[] { uploadTileFilePath });
antTask.execute();
And this does not seem to compile the file reliably. It does seem like 
something is happening, because the upload/compile action takes about 
25-30 seconds longer to load when the jsp compilation code is included. 
In my work directory, the .java and .class files are never updated (new 
time stamp) right away.

Sometimes if I wait a bit (5-10 minutes) the files are updated properly, 
but this seems to be the normal scheduled compilation.

Sometimes if I load the page up in a browser after it has been 
uploaded/compiled, it seems to be compiled on access, but this does 
not always happen.

I was messing around with the code a little bit, and tried this:
JspC antTask = new JspC();
antTask.setArgs(new String[] { -compile, uploadTileFilePath });
antTask.execute();
but this always gave me an error that javax.servlet package could not be 
found.

I then tried:
JspC antTask = new JspC();
antTask.setArgs(new String[] { uploadTileFilePath });
antTask.execute();
antTask.setArgs(new String[] { -compile, uploadTileFilePath });
antTask.execute();
and this seemed to make it (so far) that the JSP page always gets 
compiled the next time it is loaded in a browser.

This is passable if it must be the solution, but what I would really 
like is that the file gets completely compiled during the upload/compile 
action. The reason for this is that I want the person uploading to have 
to deal with the extra processing time, and not the person loading the page.

Any help with solving this problem would be greatly appreciated.
Thanks,
Matt
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: dynamically compile JSPs

2005-01-10 Thread Frank W. Zammetti
Hey, I remember this thread :)
(Mostly because you quoted my comment!)
One solution is to shell out to do the compilation.  I think I 
probably gave it to you last time, but here's the two pertinent lines 
from my compile job that does it:

java -classpath %CP% org.apache.jasper.JspC -v3 -die -d %JSPAppDir% 
-webapp %WebAppDir%

javac -classpath %CP% -d %JspDir% %JspDir%\*.java
...where...
%CP% is the classpath, inclduing servlet.jar
%JSRDir% is the location of the JSP
%WebAppDir% is something like c:\tomcat\webapps\myapp
(I modified this a tad so it's more applicable to you, but don't shoot 
me if you have to hack it slightly)

Now, what I'm thinking, AND I BY NO MEANS ENDORSE THIS AS A GOOD 
SOLUTION, is that you could shell out these two commands, and that I 
think would get the job done.  This is a has a Windows skew to it of 
course, but I can't see any reason it wouldn't work under *nix, if 
that's your environment, which just some minor changes.

I've never tried using JspC from Java code as you did, although I'd 
think that's the way you'd want to go.  I don't know what's wrong with 
the code you provided however, but if you get to that hair-pulling stage 
where you feel like your really stuck, I'm relatively sure the above 
will do it for you, if worse comes to worse.  I guess if this isn't 
something that's going to be happening a lot, it might not be a problem 
this way.

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
Matt Bathje wrote:
[EMAIL PROTECTED] wrote:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper/docs/api/index.html 

Usage of the JspC class.  This should be what you want.
I work in Windows 95% of the time, and I'm a simplicity freak, so I 
tend do do things, most of the time, with batch files called from 
UltraEdit.  Anyway, this is relevant because one of the steps in my 
typical build process is a compilation of all JSP's.  I use this class 
to do that.  I can give you the two lines from my batch file that does 
this if it would be helpful, but I tend to think the javadocs will get 
you where you want to go.



This is kind of an old thread I'm replying to - but I implemented what I 
thought would work for this, and haven't been able to get anything 
working reliably. As a refresher, the scenario is this:
- a Tomcat 5.0.x server with Jasper setup in development=false mode
- I upload a jsp page through a web interface, and want it to be 
compiled/usable immediately, instead of waiting for the scheduled jasper 
compilation
- putting ?jsp_compile=true on the page doesn't seem to work
- making development=true isn't an option

After looking through the JspC documentation a little bit, I tried this 
code in my class after the JSP file is uploaded:

JspC antTask = new JspC();
antTask.setArgs(new String[] { uploadTileFilePath });
antTask.execute();
And this does not seem to compile the file reliably. It does seem like 
something is happening, because the upload/compile action takes about 
25-30 seconds longer to load when the jsp compilation code is included. 
In my work directory, the .java and .class files are never updated (new 
time stamp) right away.

Sometimes if I wait a bit (5-10 minutes) the files are updated properly, 
but this seems to be the normal scheduled compilation.

Sometimes if I load the page up in a browser after it has been 
uploaded/compiled, it seems to be compiled on access, but this does 
not always happen.

I was messing around with the code a little bit, and tried this:
JspC antTask = new JspC();
antTask.setArgs(new String[] { -compile, uploadTileFilePath });
antTask.execute();
but this always gave me an error that javax.servlet package could not be 
found.

I then tried:
JspC antTask = new JspC();
antTask.setArgs(new String[] { uploadTileFilePath });
antTask.execute();
antTask.setArgs(new String[] { -compile, uploadTileFilePath });
antTask.execute();
and this seemed to make it (so far) that the JSP page always gets 
compiled the next time it is loaded in a browser.

This is passable if it must be the solution, but what I would really 
like is that the file gets completely compiled during the upload/compile 
action. The reason for this is that I want the person uploading to have 
to deal with the extra processing time, and not the person loading the 
page.

Any help with solving this problem would be greatly appreciated.
Thanks,
Matt
-
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: dynamically compile JSPs

2004-12-22 Thread Tim Funk
I would think that making the query string be jsp_compile=true would do it.
For example:  mypage.jsp?jsp_compile=true
[I never tried it]
-Tim
Matt Bathje wrote:
Hi all -
If you have your tomcat servers setup with development=false (compiling 
every 5 minutes) - is there a way to dynamically compile certain JSP 
pages from inside your servlet code? (Or at least to trigger a compile 
to happen off of the schedule?)

If so - are there any side effects of doing this?
 
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: dynamically compile JSPs

2004-12-22 Thread Matt Bathje
I can't seem to find any solid documentation on this (I downloaded the 
JSP 2.0 spec and don't see it mentioned, even though based on a google 
search it seems like it is is a JSP thing and not a tomcat thing)

But anyways - it doesn't seem to work for me, and I think the reason is 
that the jsp I want to compile dynamically is a struts/tiles layout 
page. There is no way to access the file directly through the browser.

I may be able to get away with putting jsp_compile=true in the tile 
definition path, but I'd like to avoid that because (if my understanding 
of this parameter is true) the page will get recompiled on every page 
load, which is really not what I want, and would probably hurt 
performance a lot.

Any other ideas for dynamic JSP compilation? Calling the compiler from 
inside the code (a struts action) if possible is not out of the question 
as long as there is no serious downside.

Thanks,
Matt

Tim Funk wrote:
I would think that making the query string be jsp_compile=true would do it.
For example:  mypage.jsp?jsp_compile=true
[I never tried it]
-Tim
Matt Bathje wrote:
Hi all -
If you have your tomcat servers setup with development=false 
(compiling every 5 minutes) - is there a way to dynamically compile 
certain JSP pages from inside your servlet code? (Or at least to 
trigger a compile to happen off of the schedule?)

If so - are there any side effects of doing this?
 

-
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: dynamically compile JSPs

2004-12-22 Thread Dale, Matt

This might be a long way round but you could call a system ant job to compile 
them. Or if it is appropriate in your environment you should just precompile 
them anyway, this way there will be no performance hit at all on your 
production server when a new deployment is made.

Ta
Matt

-Original Message-
From: Matt Bathje [mailto:[EMAIL PROTECTED]
Sent: 22 December 2004 17:01
To: Tomcat Users List
Subject: Re: dynamically compile JSPs


I can't seem to find any solid documentation on this (I downloaded the 
JSP 2.0 spec and don't see it mentioned, even though based on a google 
search it seems like it is is a JSP thing and not a tomcat thing)

But anyways - it doesn't seem to work for me, and I think the reason is 
that the jsp I want to compile dynamically is a struts/tiles layout 
page. There is no way to access the file directly through the browser.

I may be able to get away with putting jsp_compile=true in the tile 
definition path, but I'd like to avoid that because (if my understanding 
of this parameter is true) the page will get recompiled on every page 
load, which is really not what I want, and would probably hurt 
performance a lot.

Any other ideas for dynamic JSP compilation? Calling the compiler from 
inside the code (a struts action) if possible is not out of the question 
as long as there is no serious downside.


Thanks,
Matt




Tim Funk wrote:
 I would think that making the query string be jsp_compile=true would do it.
 For example:  mypage.jsp?jsp_compile=true
 
 [I never tried it]
 
 -Tim
 
 Matt Bathje wrote:
 
 Hi all -

 If you have your tomcat servers setup with development=false 
 (compiling every 5 minutes) - is there a way to dynamically compile 
 certain JSP pages from inside your servlet code? (Or at least to 
 trigger a compile to happen off of the schedule?)

 If so - are there any side effects of doing this?


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

Any opinions expressed in this E-mail may be those of the individual and not 
necessarily the company. This E-mail and any files transmitted with it are 
confidential and solely for the use of the intended recipient. If you are not 
the intended recipient or the person responsible for delivering to the intended 
recipient, be advised that you have received this E-mail in error and that any 
use or copying is strictly prohibited. If you have received this E-mail in 
error please notify the beCogent postmaster at [EMAIL PROTECTED]
Unless expressly stated, opinions in this email are those of the individual 
sender and not beCogent Ltd. You must take full responsibility for virus 
checking this email and any attachments.
Please note that the content of this email or any of its attachments may 
contain data that falls within the scope of the Data Protection Acts and that 
you must ensure that any handling or processing of such data by you is fully 
compliant with the terms and provisions of the Data Protection Act 1984 and 
1998.


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

Re: dynamically compile JSPs

2004-12-22 Thread Matt Bathje
Well they are being precompiled at first. The problem is that some of 
the pages are being uploaded/overwritten through a web interface, and 
the changes aren't immediately visible to users. (They have to wait for 
the scheduled recompile to happen to see the changes they made.)

Matt
Dale, Matt wrote:
This might be a long way round but you could call a system ant job to compile 
them. Or if it is appropriate in your environment you should just precompile 
them anyway, this way there will be no performance hit at all on your 
production server when a new deployment is made.
Ta
Matt
-Original Message-
From: Matt Bathje [mailto:[EMAIL PROTECTED]
Sent: 22 December 2004 17:01
To: Tomcat Users List
Subject: Re: dynamically compile JSPs
I can't seem to find any solid documentation on this (I downloaded the 
JSP 2.0 spec and don't see it mentioned, even though based on a google 
search it seems like it is is a JSP thing and not a tomcat thing)

But anyways - it doesn't seem to work for me, and I think the reason is 
that the jsp I want to compile dynamically is a struts/tiles layout 
page. There is no way to access the file directly through the browser.

I may be able to get away with putting jsp_compile=true in the tile 
definition path, but I'd like to avoid that because (if my understanding 
of this parameter is true) the page will get recompiled on every page 
load, which is really not what I want, and would probably hurt 
performance a lot.

Any other ideas for dynamic JSP compilation? Calling the compiler from 
inside the code (a struts action) if possible is not out of the question 
as long as there is no serious downside.

Thanks,
Matt

Tim Funk wrote:
I would think that making the query string be jsp_compile=true would do it.
For example:  mypage.jsp?jsp_compile=true
[I never tried it]
-Tim
Matt Bathje wrote:

Hi all -
If you have your tomcat servers setup with development=false 
(compiling every 5 minutes) - is there a way to dynamically compile 
certain JSP pages from inside your servlet code? (Or at least to 
trigger a compile to happen off of the schedule?)

If so - are there any side effects of doing this?


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

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


RE: dynamically compile JSPs

2004-12-22 Thread Dale, Matt
I'd go with my first suggestion then although I'm sure there's a better way.

-Original Message-
From: Matt Bathje [mailto:[EMAIL PROTECTED]
Sent: 22 December 2004 17:12
To: Tomcat Users List
Subject: Re: dynamically compile JSPs


Well they are being precompiled at first. The problem is that some of 
the pages are being uploaded/overwritten through a web interface, and 
the changes aren't immediately visible to users. (They have to wait for 
the scheduled recompile to happen to see the changes they made.)


Matt

Dale, Matt wrote:
 This might be a long way round but you could call a system ant job to compile 
 them. Or if it is appropriate in your environment you should just precompile 
 them anyway, this way there will be no performance hit at all on your 
 production server when a new deployment is made.
 
 Ta
 Matt
 
 -Original Message-
 From: Matt Bathje [mailto:[EMAIL PROTECTED]
 Sent: 22 December 2004 17:01
 To: Tomcat Users List
 Subject: Re: dynamically compile JSPs
 
 
 I can't seem to find any solid documentation on this (I downloaded the 
 JSP 2.0 spec and don't see it mentioned, even though based on a google 
 search it seems like it is is a JSP thing and not a tomcat thing)
 
 But anyways - it doesn't seem to work for me, and I think the reason is 
 that the jsp I want to compile dynamically is a struts/tiles layout 
 page. There is no way to access the file directly through the browser.
 
 I may be able to get away with putting jsp_compile=true in the tile 
 definition path, but I'd like to avoid that because (if my understanding 
 of this parameter is true) the page will get recompiled on every page 
 load, which is really not what I want, and would probably hurt 
 performance a lot.
 
 Any other ideas for dynamic JSP compilation? Calling the compiler from 
 inside the code (a struts action) if possible is not out of the question 
 as long as there is no serious downside.
 
 
 Thanks,
 Matt
 
 
 
 
 Tim Funk wrote:
 
I would think that making the query string be jsp_compile=true would do it.
For example:  mypage.jsp?jsp_compile=true

[I never tried it]

-Tim

Matt Bathje wrote:


Hi all -

If you have your tomcat servers setup with development=false 
(compiling every 5 minutes) - is there a way to dynamically compile 
certain JSP pages from inside your servlet code? (Or at least to 
trigger a compile to happen off of the schedule?)

If so - are there any side effects of doing this?


 


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


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

Any opinions expressed in this E-mail may be those of the individual and not 
necessarily the company. This E-mail and any files transmitted with it are 
confidential and solely for the use of the intended recipient. If you are not 
the intended recipient or the person responsible for delivering to the intended 
recipient, be advised that you have received this E-mail in error and that any 
use or copying is strictly prohibited. If you have received this E-mail in 
error please notify the beCogent postmaster at [EMAIL PROTECTED]
Unless expressly stated, opinions in this email are those of the individual 
sender and not beCogent Ltd. You must take full responsibility for virus 
checking this email and any attachments.
Please note that the content of this email or any of its attachments may 
contain data that falls within the scope of the Data Protection Acts and that 
you must ensure that any handling or processing of such data by you is fully 
compliant with the terms and provisions of the Data Protection Act 1984 and 
1998.


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

Re: dynamically compile JSPs

2004-12-22 Thread Matt Bathje
Oh, and setting development=true isn't really an option :)
Matt
Matt Bathje wrote:
Well they are being precompiled at first. The problem is that some of 
the pages are being uploaded/overwritten through a web interface, and 
the changes aren't immediately visible to users. (They have to wait for 
the scheduled recompile to happen to see the changes they made.)

Matt
Dale, Matt wrote:
This might be a long way round but you could call a system ant job to 
compile them. Or if it is appropriate in your environment you should 
just precompile them anyway, this way there will be no performance hit 
at all on your production server when a new deployment is made.

Ta
Matt
-Original Message-
From: Matt Bathje [mailto:[EMAIL PROTECTED]
Sent: 22 December 2004 17:01
To: Tomcat Users List
Subject: Re: dynamically compile JSPs
I can't seem to find any solid documentation on this (I downloaded the 
JSP 2.0 spec and don't see it mentioned, even though based on a google 
search it seems like it is is a JSP thing and not a tomcat thing)

But anyways - it doesn't seem to work for me, and I think the reason 
is that the jsp I want to compile dynamically is a struts/tiles layout 
page. There is no way to access the file directly through the browser.

I may be able to get away with putting jsp_compile=true in the tile 
definition path, but I'd like to avoid that because (if my 
understanding of this parameter is true) the page will get recompiled 
on every page load, which is really not what I want, and would 
probably hurt performance a lot.

Any other ideas for dynamic JSP compilation? Calling the compiler from 
inside the code (a struts action) if possible is not out of the 
question as long as there is no serious downside.

Thanks,
Matt

Tim Funk wrote:
I would think that making the query string be jsp_compile=true would 
do it.
For example:  mypage.jsp?jsp_compile=true

[I never tried it]
-Tim
Matt Bathje wrote:

Hi all -
If you have your tomcat servers setup with development=false 
(compiling every 5 minutes) - is there a way to dynamically compile 
certain JSP pages from inside your servlet code? (Or at least to 
trigger a compile to happen off of the schedule?)

If so - are there any side effects of doing this?


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


Re: dynamically compile JSPs

2004-12-22 Thread fzlists
If they are uploaded via a web interface, I assume it's your own interface... 
If so, why not just make part of the upload process a compilation?  You can 
compile it and overwrite the working copy in Tomcat, changes should be there 
instantly.  A bigger plus too is that you can catch any compile-time errors at 
that point and report back to the user with the trace, so you would never have 
any bad JSP's in production.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Wed, December 22, 2004 12:11 pm, Matt Bathje said:
 Well they are being precompiled at first. The problem is that some of
 the pages are being uploaded/overwritten through a web interface, and
 the changes aren't immediately visible to users. (They have to wait for
 the scheduled recompile to happen to see the changes they made.)
 
 
 Matt
 
 Dale, Matt wrote:
 This might be a long way round but you could call a system ant job to
 compile them. Or if it is appropriate in your environment you should
 just precompile them anyway, this way there will be no performance hit
 at all on your production server when a new deployment is made.

 Ta
 Matt

 -Original Message-
 From: Matt Bathje [mailto:[EMAIL PROTECTED]
 Sent: 22 December 2004 17:01
 To: Tomcat Users List
 Subject: Re: dynamically compile JSPs


 I can't seem to find any solid documentation on this (I downloaded the
 JSP 2.0 spec and don't see it mentioned, even though based on a google
 search it seems like it is is a JSP thing and not a tomcat thing)

 But anyways - it doesn't seem to work for me, and I think the reason is
 that the jsp I want to compile dynamically is a struts/tiles layout
 page. There is no way to access the file directly through the browser.

 I may be able to get away with putting jsp_compile=true in the tile
 definition path, but I'd like to avoid that because (if my understanding
 of this parameter is true) the page will get recompiled on every page
 load, which is really not what I want, and would probably hurt
 performance a lot.

 Any other ideas for dynamic JSP compilation? Calling the compiler from
 inside the code (a struts action) if possible is not out of the question
 as long as there is no serious downside.


 Thanks,
 Matt




 Tim Funk wrote:

I would think that making the query string be jsp_compile=true would do
 it.
For example:  mypage.jsp?jsp_compile=true

[I never tried it]

-Tim

Matt Bathje wrote:


Hi all -

If you have your tomcat servers setup with development=false
(compiling every 5 minutes) - is there a way to dynamically compile
certain JSP pages from inside your servlet code? (Or at least to
trigger a compile to happen off of the schedule?)

If so - are there any side effects of doing this?





-
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]
 
 
 -
 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: dynamically compile JSPs

2004-12-22 Thread Matt Bathje
[EMAIL PROTECTED] wrote:
If they are uploaded via a web interface, I assume it's your own interface... 
If so, why not just make part of the upload process a compilation?  You can 
compile it and overwrite the working copy in Tomcat, changes should be there 
instantly.  A bigger plus too is that you can catch any compile-time errors at 
that point and report back to the user with the trace, so you would never have 
any bad JSP's in production.

Well...that is my question...I can't figure out how to do that 
compilation :)

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


Re: dynamically compile JSPs

2004-12-22 Thread fzlists
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper/docs/api/index.html

Usage of the JspC class.  This should be what you want.

I work in Windows 95% of the time, and I'm a simplicity freak, so I tend do do 
things, most of the time, with batch files called from UltraEdit.  Anyway, this 
is relevant because one of the steps in my typical build process is a 
compilation of all JSP's.  I use this class to do that.  I can give you the two 
lines from my batch file that does this if it would be helpful, but I tend to 
think the javadocs will get you where you want to go.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Wed, December 22, 2004 12:32 pm, Matt Bathje said:
 [EMAIL PROTECTED] wrote:
 If they are uploaded via a web interface, I assume it's your own
 interface... If so, why not just make part of the upload process a
 compilation?  You can compile it and overwrite the working copy in
 Tomcat, changes should be there instantly.  A bigger plus too is that
 you can catch any compile-time errors at that point and report back to
 the user with the trace, so you would never have any bad JSP's in
 production.



 
 Well...that is my question...I can't figure out how to do that
 compilation :)
 
 
 Matt
 
 -
 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]