tags:

views:

729

answers:

2

I keep running into this problem when debugging JSP pages in OpenNMS. The Jetty wiki talks about keepGenerated (http://docs.codehaus.org/display/JETTY/KeepGenerated) in webdefault.xml but it seems unclear how this works in embedded setups.

A: 

It is dumped already. for example if you have a file called index.jsp, a file will be created called index_jsp.java Just search for something like that in the work directory.

Javaxpert
Hmm, there are some ${page}_jsp.java files around but they don't seem to update when I change the related jsp page even though the results show up straight away on the browser.
stsquad
+2  A: 

If you are using Jetty 6 you can use the following code:

String webApp = "./web/myapp"; // Location of the jsp files
String contextPath = "/myapp";
WebAppContext webAppContext = new WebAppContext(webApp, contextPath); 
ServletHandler servletHandler = webAppContext.getServletHandler();
ServletHolder holder = new ServletHolder(JspServlet.class);
servletHandler.addServletWithMapping(holder, "*.jsp");
holder.setInitOrder(0);
holder.setInitParameter("compiler", "modern");
holder.setInitParameter("fork", "false");

File dir = new File("./web/compiled/" + webApp);
dir.mkdirs();
holder.setInitParameter("scratchdir", dir.getAbsolutePath());
Roel Spilker