DEV Community

Orestis Pantazos
Orestis Pantazos

Posted on

🦸 My popular post on Stackoverflow

The only way to modify web.xml to support for multiple servlet in JSPs, there is a way as shown in the following post on Stackoverflow network:

<?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>LoginForm</servlet-name>
        <servlet-class>com.project.system.LoginForm</servlet-class>
    </servlet>
    <servlet>
        <servlet-name>RegisterForm</servlet-name>
        <servlet-class>com.project.system.RegisterForm</servlet-class>
    </servlet>
    <servlet>
        <servlet-name>UserController</servlet-name>
        <servlet-class>com.project.controller.UserController</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>LoginForm</servlet-name>
        <url-pattern>/LoginForm</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>RegisterForm</servlet-name>
        <url-pattern>/RegisterForm</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>UserController</servlet-name>
        <url-pattern>/UserController</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
</web-app>

Enter fullscreen mode Exit fullscreen mode

https://stackoverflow.com/questions/43559372/how-to-modify-web-xml-for-multiple-servlet

Top comments (0)