1

I am working on a spring project and i have this strange error with a 404 not found

when i call localhost:8080/BMS/ i got the following error

 No mapping found for HTTP request with URI [/BMS/$%7B] in DispatcherServlet with name 'spring'

note that : i made an Index.html file as a welcome file under the webapp folder that redirect to the login page inside the WEB-INF folder

so my question is what is this $%7B in the error and how i can fix this ?

index.html

<head>
   <meta http-equiv="refresh" content="0; url=http://localhost:8080/BMS/login.html" />
</head>

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">
  <display-name>BMS</display-name>

   <filter>
        <filter-name>encoding-filter</filter-name>
        <filter-class>
            org.springframework.web.filter.CharacterEncodingFilter
        </filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
        <param-name>forceEncoding</param-name>
        <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>encoding-filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

  <servlet>
        <servlet-name>default</servlet-name>
        <servlet-class>
          org.apache.catalina.servlets.DefaultServlet
        </servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>listings</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
   <servlet>
   <servlet-name>spring</servlet-name>
   <servlet-class>
    org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
     <servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/*</url-pattern>
       </servlet-mapping> 
   <servlet-mapping>
     <servlet-name>spring</servlet-name>
    <url-pattern>/login.html</url-pattern>
    </servlet-mapping> 
    <servlet-mapping>
     <servlet-name>spring</servlet-name>
    <url-pattern>*.html</url-pattern>
    </servlet-mapping> 

    <servlet-mapping>
 <servlet-name>default</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
 </welcome-file-list>

</web-app>
Dunken
  • 1,311
  • 7
  • 18
  • 30

1 Answers1

1

According to URL encoding Reference %7B means {

Look at this line of your index.html

<meta http-equiv="refresh" content="0; url=http://localhost:8080/BMS/login.html" />

Try removing SPACE between zero & url. Making url to URL.

<meta http-equiv="refresh" content="0;URL=http://localhost:8080/BMS/login.html" />

Hope this will help you.

OO7
  • 2,785
  • 1
  • 21
  • 33
  • thank you for your answer but its the same nothing changed – Dunken Jul 07 '14 at 12:24
  • Try with `JSTL Core Tag` & convert your index.html to index.jsp Bcoz redirect with meta tag is not supported in all browsers & The W3C recommends that this tag not be used. They recommend using a server-side 301 redirect instead. For more information on decoding read these http://visitivitymedia.com/decoding-meta-tags/ & http://stackoverflow.com/questions/6138127/how-to-do-url-decoding-in-java – OO7 Jul 07 '14 at 12:46
  • Did u found the solution ? – OO7 Jul 08 '14 at 04:27