0

can someone tell me how to setup my project structure and my web.xml? In my dynamic web project in the java resources folder i have a servlet (class name: RestFulService) which delivers a JSON file. The web pages are in the WebContent-folder, for example index.jsp. The project is published with a glassfish server. This is my current web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="WebApp_ID" version="3.0">
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
        <servlet-name>RestFulService</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>jersey.config.server.provider.packages</param-name>
            <param-value>com.javasrc, com.jersey.jaxb, com.fasterxml.jackson.jaxrs.json</param-value>
        </init-param>
        <init-param>
            <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>RestFulService</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>

The link to access the JSON works well (http://localhost:8080/BCode/liveHelp/getText) but if i want to access the index.jsp via "http://localhost:8080/BCode/index.jsp" all i get is an error 404 page. Can anyone please tell me where the problem is an what i have to change to get it working? I guess the problem is in the web.xml but I don't have any idea what to change.

0 Answers0