[ad_1]
I’m new and self learnt through online courses and have a trouble understanding why my doGet isn’t responding to the sent parameter, my code is very basic actually and It’s the exact same as the one that in the video, I’m using Eclipse, and here’s the code;
package com.linkedin.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class CatalogServlet
*/
@WebServlet("/CatalogServlet")
public class CatalogServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public CatalogServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
super.service(request, response);
response.getWriter().append(request.getParameter("name"));
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
and when I go to ** http://localhost:8080/hsports-catalog-servlet/CatalogServlet?name=AnyName **
it gives me out “Not Found”
thanks for help in advance!
[ad_2]