lundi 31 août 2015

Run servlet before anything else

I have a dynamic web project with a servlet (structure below).

When right-clicking HomeServlet.java --> Run as --> Run on Server --> Tomcat...
It runs fine with the URL: http://localhost:8080/JSTLTest/HomeServlet

When right-clicking JSTLTest --> Run as --> Run on Server --> Tomcat...
I get an error and this URL is used: http://localhost:8080/JSTLTest/

The problem is, i want to deploy it on a server like AWS elastic beanstalk and i guess it doesn't work because he won't use the servlet to start, like:
http://ift.tt/1LNAFDvHomeServlet

Is my web.xml wrong?

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://ift.tt/ra1lAU"
    xmlns="http://ift.tt/19L2NlC"
    xsi:schemaLocation="http://ift.tt/19L2NlC http://ift.tt/1drxgYl"
    version="3.1">
    <display-name>JSTLTest</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
        <servlet-name>Home</servlet-name>
        <servlet-class>com.journaldev.servlet.HomeServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Home</servlet-name>
        <url-pattern>/HomeServlet</url-pattern>
    </servlet-mapping>
</web-app>

Structure:

enter image description here




Aucun commentaire:

Enregistrer un commentaire