Hi,
I am beginner to JAVA and I have the following doGet method, and I need to call to from another method
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String url = ""; //if the number is minus n does not exist if (Code < 0 ) { url = "/Error.jsp"; } //if the number is not included else { url = "/Error.jsp"; } // forward to the view RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url); dispatcher.forward(request, response); }
I want to know how to call this method from another method, just like the following.
public int getCode() { if (stateName.equals("Aden") || stateName.equals("aden") || stateName.equals("ADEN")) { Code = 01; return (Code); } else if (stateName.equals("Mukalla") || stateName.equals("mukalla") || stateName.equals("MUKALLA")) { Code = 02; return (Code); } else { return doGet(request, response); } }
the line
return doGet(request, response);
I want to know the correct way of calling?