我需要执行一个JSP.但我需要直接从Java,而不使用Tomcat或任何其他servlet容器.编译JSP也是一件好事,但不是必需的.我想也许org.apache.jasper包可以做到这一点,但我找不到任何好的示例或在线教程.
我需要一些东西:
Class compiledJSP = compileJSP(new File("helloWorld.jsp"));
String html = executeJSP(compiledJSP, httpServletRequest, httpServletResponse, ...);
html --> "Hello World, John!"
Run Code Online (Sandbox Code Playgroud)
谢谢!