• Post Reply Bookmark Topic Watch Topic
  • New Topic

Force jsp to touch a file and compile it

 
Michelle Lee
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since one of jsp only run once. So I think forcing compiler compile this jsp file every time it run may be a good idea.
At the end of this file I add the code below:
<%
String filename =application.getRealPath
("/Modify.jsp");
Runtime sys = java.lang.Runtime.getRuntime();
sys.exec( "touch "+filename );
%>
but without sucess.
if I use command > touch Modify.jsp
this file can be compile sucessfully.
Although a silly idea, can anybody tell me if there is a flexible way to force a jsp to be compiled in tomcat4.1.12? Thank you!
[ January 23, 2003: Message edited by: michelle Lee ]
[ January 23, 2003: Message edited by: michelle Lee ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think this is a good approach.
You are far better off diagnosing and fixing the problem you had in your previous post
JSPs just aren't designed to be recompiled and run every time they are hit. The performance would quite likely be attrocious and could possibly have other issues crop up - like the ClassCastExceptions that turn up in Tomcat when you are changing files in the background while the server is running.
Dave
 
Michelle Lee
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,
Thank you for point out. I know it is hacking instead of programming. But I found out this approch almost work. I only need to refresh it sometimes.
[ January 23, 2003: Message edited by: michelle Lee ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David is right. The time you are spending trying to get your hack to work is a total waste and would be better spent trying to solve the real problem. Usually, such "band-aid" hacks only lead to further problems and you spend all your time trying to hack the hacks to get things to work. That way lies madness.
hth,
bear
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!