Results 1 to 4 of 4
  1. #1
    kkji is offline Member
    Join Date
    Aug 2011
    Posts
    54
    Rep Power
    0

    Default Why servlet application donot have main() method?

    Is main() only needed for console application?

  2. #2
    kkji is offline Member
    Join Date
    Aug 2011
    Posts
    54
    Rep Power
    0

    Default Re: Why servlet application donot have main() method?

    5o views till now but no reply.

  3. #3
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: Why servlet application donot have main() method?

    Quote Originally Posted by kkji View Post
    5o views till now but no reply.
    In the amount of time you have waited for an answer on this forum you could have searched the internet and found the answer a thousand times over: servlet main method

    I have mentioned this in another thread of yours and will do so again here
    You really need to learn how to ask questions the right way, and how to utilize all the resources at your disposal. Virtually all of your posts could be answered with a quick web search and a small amount of time reading.
    And I will post this link one more time:
    How To Ask Questions The Smart Way

    Seriously, if you want help, post a question that is answerable beyond forcing us to post links to google searches - its a waste of all of our time should you continue to do so.

  4. #4
    kkji is offline Member
    Join Date
    Aug 2011
    Posts
    54
    Rep Power
    0

    Default Re: Why servlet application donot have main() method?

    Q: What happens if I add a main method to my servlet?
    A: It is possible to write a main method for a servlet, but it will not be called by the servlet container, it is not part of the servlet lifecycle process. If you invoke your servlet through the main method using the java command it will behave exactly like a standard Java class, it cannot operate as a Web application in its own right and cannot be addressed using HTTP requests. Servlets must run in a servlet container to deliver Web applications as intended.

    => I am conufesd by this answer as pe this main() and by google search I am not getting satisfactory answer.

Similar Threads

  1. Running main method class from another main class
    By tlrocketman in forum New To Java
    Replies: 3
    Last Post: 12-06-2010, 09:30 AM
  2. Calling The main method from another method
    By SwissR in forum New To Java
    Replies: 3
    Last Post: 07-27-2010, 12:03 PM
  3. How to Call servlet through Java client (from main)
    By akbjavauser in forum Java Servlet
    Replies: 3
    Last Post: 01-20-2010, 07:15 PM
  4. calling method from main method
    By bob_bee in forum New To Java
    Replies: 4
    Last Post: 10-02-2009, 06:30 PM
  5. Invoking Servlet from SWT application
    By wolve634 in forum SWT / JFace
    Replies: 1
    Last Post: 03-30-2009, 12:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •