Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tomcat config for development -- any way to recompile jsp every time?

Status
Not open for further replies.

xor

Programmer
Jan 7, 2001
71
NZ
I am writing jsp pages and serving them with tomcat, I trying to apply the fusebox methodology (I'm used to using it with coldfusion, and I'm trying to adapt it to jsp), so I've got a switch statement in my index.jsp page which looks at a url variable and decides which content page to load. The problem is that if I make changes to a content page I am working on I have found that I must also make a change to the index.jsp page and save that in order to get tomcat to recompile the jsp page that I am really working on. Is there anyway to get tomcat to recompile pages every time you reload a page in the browser? It would make my development cycle so much easier.

TIA,
Donna
 
maybe this is overkill for what you want, but you could write a jsp compiler class that takes in a jsp page name as a command line argument, converts it to a url the server can understand and compiles it.
For example, if your jsps are under the /test firectory under the webserver's jsp default directory, and your webserver is listening on port 7001, then do the following:

String jspName="test.jsp";
String hostURL = "String jspDir = "/test/";
String urlString = hostURL + jspDir + jspName;
URL url = new URL(urlString);
URLConnection uc = url.openConnection();
uc.getInputStream();

This should compile the /test/test.jsp file under the webserver's default jsp path ( assuming of course the server is up and running). You could of course use this code to compile all your jsps by writing a for loop and passing them in one by one. BTW the above code won't work as is, there are exceptions to catch etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top