Announcement Announcement Module
Collapse
No announcement yet.
Problem with web.xml in spring web application Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with web.xml in spring web application

    hi,

    i was trying out a simple spring web mvc application example dat jst explains the skeleton of mvc framework using Eclipse n tomcat...

    following is the code of the welcome html page

    Code:
    <html><body>
    <form action=path method="POST">
    <p>Username: <input type="text" name="username"></p>
          <p>Password: <input type="password" name="password">
          <p><input type="submit" value="Submit">
        </form>
    
    </body></html>
    wen i m clicking the link it is failing to locate the servlet and the resource not found error is displayed in the browser::

    Code:
    HTTP Status 404 - Servlet myserv is not available
    
    --------------------------------------------------------------------------------
    
    type Status report
    
    message Servlet myserv is not available
    
    description The requested resource (Servlet myserv is not available) is not available.
    
    
    --------------------------------------------------------------------------------
    
    Apache Tomcat/6.0.18

    here is how my web.xml file looks like

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_9" version="2.4" xmlns=path--ns/j2ee xmlns:xsi=path--/XMLSchema-instance' 	xsi:schemaLocation=path-- xml/ns/j2ee/web-app_2_4.xsd'>
      
    <display-name>abc</display-name>
      
      <servlet>	    
    	    <servlet-name>myserv</servlet-name>
    	    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    	    <load-on-startup>1</load-on-startup>
    	  </servlet>
    	
    	  <servlet-mapping>
    	    <servlet-name>myserv</servlet-name>
    	    <url-pattern>/app/*</url-pattern>
      </servlet-mapping>
      
      <welcome-file-list>
    		<welcome-file>login.html</welcome-file>
    	</welcome-file-list>
    </web-app>
    the underlined words(org,etc.) are getting underlined in eclipse also and it gives the warning that the words are not correctly spelled...

    the configuration file myserv-servlet.xml looks like following...EgServlet is my Controller class....

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
    		...dtd/spring-beans-2.0.dtd'>
    
    <beans>
    
    <bean id="EgServ"
    class="EgServlet">
    </bean>
    
    <bean id="viewResolver"
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix">
    <value>/WEB-INF/</value>
    </property>
    <property name="suffix">
    <value>.jsp</value>
    </property>
    </bean>
    
    <bean id="urlMapping"
    class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="mappings">
    <props>
    <prop key="/*">EgServ</prop>
    </props>
    </property>
    </bean>
    
    </beans>

    i m not sure bt i guess the problem is with dispatcher servlet and d required "myserv" servlet is not getting created....

    can anyone figure out problem ...plz help.. ... thanx in advance
    Last edited by ankie; Nov 8th, 2008, 11:23 AM.

  • #2
    Check your console for any issues starting tomcat/your servlet.

    Comment

    Working...
    X