Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Default HTTP Status 404-The requested resource is not available.(HTTP Status 404 - /host-manager/)
Default HTTP Status 404-The requested resource is not available. [message #1822692] Wed, 11 March 2020 14:09 Go to next message
Jinny minnu is currently offline Jinny minnuFriend
Messages: 1
Registered: March 2020
Junior Member
package com.servlets;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class AddEmpServlet extends HttpServlet
{

public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{

res.setContentType("text/html");
PrintWriter out=res.getWriter();

String uname=req.getParameter("uname");
String pass=req.getParameter("pass");

out.println("<html><body>");
out.println("<center> Mysite </center>");
out.println("<a href='addEmp?uname="+uname+"'>AddEmp</a><br/>");
out.println("Welcome: "+uname);
out.println("<center><forn action='addEmp'>");
out.println("Emp No:<input type=text name=emp no/>") ;
out.println("<input type=submit value=AddEmp/>");
out.println("</form></body></html>");
}
};
LoginServlet::



package com.servlets;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class LoginServlet extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{
String uname=req.getParameter("uname");
String pass=req.getParameter("pass");

System.out.println("uname" +uname);
res.setContentType("text/html");

PrintWriter out=res.getWriter();

out.println("<html><body>");
out.println("<center> Mysite </center>");
out.println("<a href='addEmp?uname="+uname+"'>AddEmp</a><br/>");
out.println("<a href='ViewEmp?uname="+uname+"'>ViewEmp</a>");
out.println("Welcome: "+uname);
out.println("</body></html>");
}
};


xml::

<web-app>
<servlet>
<servlet-name>LS</servlet-name>
<servlet-class>com.servlets.LoginServlet</servlet-class>
</servlet>

<servlet>
<servlet-name>AS</servlet-name>
<servlet-class>com.</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>LS</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>AS</servlet-name>
<url-pattern>/AddEmpServlet</url-pattern>
</servlet-mapping>
</web-app>


One login.html File::

Dir Structure::



│ AddEmpServlet.java
│ Login.html
│ LoginServlet.java

└───WEB-INF
│ web.xml

└───Classes
└───com
└───servlets
AddEmpServlet.class
LoginServlet.class


Got error when tried to access ""
Re: Default HTTP Status 404-The requested resource is not available. [message #1822699 is a reply to message #1822692] Wed, 11 March 2020 15:38 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4507
Registered: July 2009
Senior Member

What do you think should be served for /host-manager/, and why? Usually you'd need to configure a welcome-page or have some kind of mapping for that URI to return content.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:For the Designers among you: We need a new logo and icon
Next Topic:Server Tomcat v9.0 Server at localhost failed to start
Goto Forum:
  


Current Time: Mon Dec 09 22:56:51 GMT 2024

Powered by FUDForum. Page generated in 0.02710 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top