Reputation: 91
I write in Eclipse an application that connect my file Calculator.war.
import java.util.Scanner;
import org.eclipse.jetty.server.*;
import org.eclipse.jetty.webapp.WebAppContext;
public class HelloWorld{
public static void main(String[] args) throws Exception {
Server server = new Server(1490);
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setWar("D:/Calculator.war");
server.setHandler(webapp);
server.start();
Scanner console = new Scanner(System.in);
while(!console.nextLine().equals("stop"));
console.close();
server.stop();
}
}
If i open in a browser link localhost:1490 i receive an error message: "JSP not configured and smth about /lib/jsp" If i write localhost:1490/ServletCalculator everything is OK.
I connected to JARs to the project jetty-all-8.1.7.v20120910.jar и servlet-api-3.0.jar. Then i tried to connect jars from /lib/jsp but it didn't succeed. I DON'T USE MAVEN Is it possible to solve this problem? How?
Upvotes: 2
Views: 4758
Reputation: 11657
Enabling JSP support in Jetty is a complex job. Multiple steps must be performed. Finally, I have succeeded and I have documented the entire process in this tutorial under Enabling JavaServer Pages header.
Upvotes: 1
Reputation: 91
here is my web.xml. But inspite of the fact that there is no information about index.jsp it loads by with adress localhost:1490/
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<servlet>
<servlet-name>ServletCalculator</servlet-name>
<servlet-class>main_pack.ServletCalculator</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletCalculator</servlet-name>
<url-pattern>/ServletCalculator</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
Upvotes: 0