title: Eclipse Tomcat Error 404
body: <p>I am a newbee trying to learn JSF. Can you please help me with the error 404 in eclipse..!
  I tried changing the server details by going into Properties and still it give me the error.</p>
  
  <p>Please help me with this. thanks in advance.</p>
  
  <p>my login code is as folows:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" 
        xmlns:ui="http://java.sun.com/jsf/facelets" 
        xmlns:h="http://java.sun.com/jsf/html" 
        xmlns:f="http://java.sun.com/jsf/core"&gt;
  
     &lt;head&gt;&lt;title&gt;JSF Login&lt;/title&gt;&lt;/head&gt;
   &lt;body&gt;
       &lt;h1&gt;Login&lt;/h1&gt;
   &lt;h:form&gt;
  &lt;table&gt;
   &lt;tr&gt;
  &lt;td&gt;&lt;h:outputText value="Username: " /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;h:inputText id="loginname" 
   value="#{loginBean.uname}" /&gt;
   &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;h:outputText value="Password: " /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;h:inputSecret id="password" 
  value="#{loginBean.password}" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt; &lt;/td&gt;
  &lt;td&gt;&lt;h:commandButton value="Login" 
  action="#{loginBean.loginProject()}"/&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;/h:form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My loginbean file:</p>
  
  <pre><code>package beans;
  
  import dao.UserDAO;
  import java.io.Serializable;
  import javax.faces.application.FacesMessage;
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.SessionScoped;
  import javax.faces.context.FacesContext;
  import javax.servlet.http.HttpSession;
  
  @ManagedBean(name = "loginBean")
  @SessionScoped
  /**
   *
   * @author User
   */
  public class LoginBean implements Serializable {
  
      private static final long serialVersionUID = 1L;
      private String password;
      private String message, uname;
  
      public String getMessage() {
          return message;
      }
  
      public void setMessage(String message) {
          this.message = message;
      }
  
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      public String getUname() {
          return uname;
      }
  
      public void setUname(String uname) {
          this.uname = uname;
      }
  
      public String loginProject() {
          boolean result = UserDAO.login(uname, password);
          if (result) {
              // get Http Session and store username
              HttpSession session = Util.getSession();
              session.setAttribute("username", uname);
  
              return "home";
          } else {
  
              FacesContext.getCurrentInstance().addMessage(
                      null,
                      new FacesMessage(FacesMessage.SEVERITY_WARN,
                      "Invalid Login!",
                      "Please Try Again!"));
  
              // invalidate session, and redirect to other pages
  
              //message = "Invalid Login. Please Try Again!";
              return "login";
          }
      }
  
      public String logout() {
        HttpSession session = Util.getSession();
        session.invalidate();
        return "login";
     }
  }
  </code></pre>
  
  <p>Web.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"&gt;
   &lt;context-param&gt;
    &lt;param-name&gt;javax.faces.PROJECT_STAGE&lt;/param-name&gt;
    &lt;param-value&gt;Development&lt;/param-value&gt;
   &lt;/context-param&gt;
    &lt;listener&gt;  
          &lt;listener-class&gt;  
              com.sun.faces.config.ConfigureListener  
          &lt;/listener-class&gt;  
      &lt;/listener&gt;
   &lt;welcome-file-list&gt;
    &lt;welcome-file&gt;login.xhtml&lt;/welcome-file&gt;
   &lt;/welcome-file-list&gt;
  
  &lt;/web-app&gt;
  </code></pre>