Reputation: 6030
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.
Upvotes: 5
Views: 2178
Reputation: 3750
I know this is ages old, but I haven't found the answer anywhere else on the internet and it doesn't seem as though this has gotten any easier. Hopefully this will help someone:
extract your webdefault.xml from the jetty-version.jar, mine was in :C:\Documents and Settings\JB.m2\repository\org\mortbay\jetty\jetty\6.1.22\jetty-6.1.22.jar inside the org/mortbay/jetty/webapp/webdefault.xml file
Put the webdefault.xml into my project directory
Edit the webdefault.xml and add the following line:
<servlet id="jsp">
....
<init-param>
<param-name>keepgenerated</param-name>
<param-value>true</param-value>
</init-param>
Add the following into your maven pom.xml config:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<webDefaultXml>webdefault.xml</webDefaultXml>
</configuration>
</plugin>
When you run the mvn jetty:run
maven goal my jsp code is now kept in target\work\jsp\org\apache\jsp\WEB_002dINF\jsp
Upvotes: 3
Reputation: 34512
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());
Upvotes: 2
Reputation: 2355
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.
Upvotes: 0