Hello peeps,
I want to test out this program but i am having problems!
each time i run it - it goes
" java.lang.NoSuchMethodError: main
Exception in thread "main" "
I know why i am having this error - coz i am missing my "public static void ....."
But the real problem i am having is - calling the method to the main class ! sorri i am beginner - so plz be gentle !
here is the code !
public class h extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//
// Get client's IP address
//
String clientIP = request.getRemoteAddr();
//
// Get client's host name
//
String clintHost = request.getRemoteHost();
//response.setContentType("text/plain");
PrintWriter out = response.getWriter();
out.println("IP : " + clientIP);
out.println("Host: " + clintHost);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
i have tried doing
public static void main (String []arg){
h method = new h();
System.out.println(clientIP);
}
but of course its error - i no its a simple problem !:$
Thanks :)