Problem with web.xml

hey guys,

i'm using netbeans 5.5 to develop my first servlet application. i created my project and tried to configure the web.xml file. here is my xml file:

<?xml version="1.0" encoding="UTF-8"?>

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<servlet>

<servlet-name>td1_1</servlet-name>

<servlet-class>Td1_1</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>td1_1</servlet-name>

<url-pattern>/Main</url-pattern>

</servlet-mapping>

<session-config>

<session-timeout>

30

</session-timeout>

</session-config>

<welcome-file-list>

<welcome-file>

index.jsp

</welcome-file>

</welcome-file-list>

</web-app>

the first time i started the application i set the url-pattern to /Home.

when i now try to change the url-pattern to /Main, it is not updated. it is still looking for /Home

i saved and compiled everything but still the same result:

HTTP Status 404 - /td1.1/Home

type Status report

message /td1.1/Home

description The requested resource (/td1.1/Home) is not available.

Apache Tomcat/5.5.17

[1645 byte] By [Toto] at [2007-11-26 12:16:15]
# 1

It seems to me that you changed the url-pattern but forgot to change the url in your servlet/jsp that is referring to the servlet. The 404 error is coming from the browser because it cannot find the url 'td1.1/Home'. You need to find where that url is being used in your code and change it to 'Main'.

gimbal2 at 2007-7-7 14:52:02 > top of Java-index,Archived Forums,Socket Programming...
# 2

hi,

i didn't found another occurence of td1.1/home.

so what i did is creating a simple web project. i than just added a java class that implements the Servlet interface:

package com.labosun.hello;

import java.io.IOException;

import javax.servlet.ServletConfig;

import javax.servlet.ServletException;

import javax.servlet.ServletRequest;

import javax.servlet.ServletResponse;

/*

* Td1_1.java

*

* Created on December 12, 2006, 10:18 AM

*

* To change this template, choose Tools | Template Manager

* and open the template in the editor.

*/

/**

*

* @author gillesthoma

*/

public class Td1_1 implements javax.servlet.Servlet {

/**

* Creates a new instance of Td1_1

*/

public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {

// Sp閏ification du type

res.setContentType("text/html");

PrintWriter out = res.getWriter();

out.print("<html><head><body>Hello World</body></head></html>");

}

public void init(ServletConfig config) throws ServletException {

}

public ServletConfig getServletConfig() {

return null;

}

public String getServletInfo() {

return null;

}

public void destroy() {

}

}

Message was edited by:

Toto

Toto at 2007-7-7 14:52:02 > top of Java-index,Archived Forums,Socket Programming...