How do you get the embedded Jetty web server to upload your Java temporary code for JSP?

I continue to encounter this issue when debugging JSP pages in OpenNMS. The Jetty quiz talks about keepGenerated ( http://docs.codehaus.org/display/JETTY/KeepGenerated ) in webdefault.xml, but it seems unclear how this works in the built-in settings.

+5
source share
3 answers

I know this is age, but I have not found the answer anywhere on the Internet, and it seems that it has become easier. Hope this helps someone:

webdefault.xml jetty-version.jar, : C:\Documents and \JB.m2\\org\mortbay\jetty\jetty\6.1.22\jetty-6.1.22.jar org/mortbay/jetty/webapp/webdefault.xml

webdefault.xml

webdefault.xml :

<servlet id="jsp">
 ....
  <init-param>
    <param-name>keepgenerated</param-name>
    <param-value>true</param-value>
  </init-param>

maven pom.xml:

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>maven-jetty-plugin</artifactId>
  <configuration>    
    <webDefaultXml>webdefault.xml</webDefaultXml>
  </configuration>
</plugin>

mvn jetty:run maven, jsp target\work\jsp\org\apache\jsp\WEB_002dINF\jsp

+3

Jetty 6, :

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());
+2

. , index.jsp, index_jsp.java - .

0

All Articles