임베디드 부두 9.3.9 서버를 설정하려고하는데, Jetty 서버에 대한 JSP 지원을 구성했습니다. 그러나 시도 할 때마다이 물건에 익숙하지 않았습니다. 모든 JSP 페이지를로드, 내가받을 -JSP로 임베디드 부두에 대한 클래스를 컴파일 할 수 없음 9
Unable to compile class for JSP: ||An error occurred at line: [1] in the generated java file: [/tmp/jetty-0.0.0.0-8080-webapp-_webMvc-any-4185149399836239637.dir/jsp/org/apache/jsp/WEB_002dINF/views/index_jsp.java]|The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files||An error occurred at line: [1] in the generated java file: [/tmp/jetty-0.0.0.0-8080-webapp-_webMvc-any-4185149399836239637.dir/jsp/org/apache/jsp/WEB_002dINF/views/index_jsp.java]|The type java.io.ObjectInputStream cannot be resolved|Syntax error on token "<", ? expected after this token|
내 JSP 지원은 다음과 같습니다
`public static void main(String[] args) throws Exception {
Server server = new Server(8080);
System.setProperty("org.apache.jasper.compiler.disablejsr199", "false");
WebAppContext webAppContext = new WebAppContext();
webAppContext.setDescriptor("/webMvc/src/main/webapp/WEB-INF/web.xml");
webAppContext.setConfigurations(new Configuration[] {
new AnnotationConfiguration(),
new WebInfConfiguration(),
new WebXmlConfiguration(),
new MetaInfConfiguration(),
new FragmentConfiguration(),
new EnvConfiguration(),
new PlusConfiguration(),
new JettyWebXmlConfiguration()
});
webAppContext.setAttribute("javax.servlet.context.tempdir", getScratchDir());
webAppContext.setResourceBase("/webMvc/src/main/webapp/");
webAppContext.setContextPath("/webMvc");
webAppContext.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/.*taglibs.*\\.jar$");
webAppContext.setAttribute("org.eclipse.jetty.containerInitializers", jspInitializers());
webAppContext.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
webAppContext.addBean(new ServletContainerInitializersStarter(webAppContext), true);
webAppContext.setClassLoader(new URLClassLoader(new URL[0], this.getClass().getClassLoader()));
webAppContext.setParentLoaderPriority(true);
ProtectionDomain protectionDomain = ServerStart.class.getProtectionDomain();
URL location = protectionDomain.getCodeSource().getLocation();
webAppContext.setWar(location.toExternalForm());
server.setHandler(webAppContext);
server.start();
server.join();
}
private File getScratchDir() throws IOException {
File tempDir = new File(System.getProperty("java.io.tmpdir"));
File scratchDir = new File(tempDir.toString(), "webMvc-jetty-jsp");
scratchDir.mkdirs();
return scratchDir;
}
private ServletHolder jspServletHolder() {
ServletHolder holderJsp = new ServletHolder("jsp", JettyJspServlet.class);
holderJsp.setInitOrder(0);
holderJsp.setInitParameter("logVerbosityLevel", "INFO");
holderJsp.setInitParameter("fork", "false");
holderJsp.setInitParameter("xpoweredBy", "false");
holderJsp.setInitParameter("compilerTargetVM", "1.8");
holderJsp.setInitParameter("compilerSourceVM", "1.8");
holderJsp.setInitParameter("keepgenerated", "true");
return holderJsp;
}`
내 프로젝트 구조입니다 - `
01 `jettyStartup
|-src/main/java
|- ServerStart.java
webMvc
|- src/main/java
| |- Package com.admin.controllers
| |- BaseController
|- src
|- main
|- webapp
|- META-INF
|- WEB-INF
|- web.xml
|- views
|-index.jsp
|-error.jsp
23,516,는 내가 전쟁 파일을 만들고 부두 서버로 공급 (모듈 형 것에 대해) MVC 용 서버와 또 다른 시작을위한 별도의 프로젝트가 있습니다. 모든 JSP 페이지를 때까지 잘 작동합니다.
내 index.jsp에서입니다
<%@ page import="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter" %>
<%@ page import="org.springframework.security.core.AuthenticationException" %>
<!DOCTYPE html>
<head>
<link href="css/themes/jquery-ui.css" rel="stylesheet" type="text/css"/>
<link href="css/themes/page-theme.css" rel="stylesheet" type="text/css"/>
<link href="css/index.css" rel="stylesheet" type="text/css">
<link href="css/jquery.modaldialog.css" rel="stylesheet" type="text/css">
<script type="application/javascript" src="js/jquery/jquery-1.4.4.js"></script>
<script type="application/javascript" src="js/jquery/jquery-ui-1.8.10.custom.js"></script>
<script src="js/index.js" type="text/javascript"></script>
</head>
<body>
<div id="page-login" >
<form id="login" method="POST" action="j_spring_security_check" autocomplete="off">
<div id="login-credentials">
<label>Username:
<input type="text" name="j_username" id="j_username"/>
</label>
<label> Password:
<input type="password" name="j_password" id="j_password" />
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
</label>
</div>
<input type="submit" id="login-btn" value="Log in" />
<div style="clear:right"></div>
</form>
</div>
</body>
</html>
그리고 이것이 JSP에 중요한 자바 코드가없는 이유입니다. –
@ ThorbjørnRavnAndersen이 코드는 JSP의 일부가 아니며 임베디드 - 부두 서버를 시작하는 Java 클래스 – devop