Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

blank page , no error, no output on running servlet

 
Allen Bandela
Ranch Hand
Posts: 128
Eclipse IDE MS IE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody.

I've looked at the configuration again and again. The web.xml has a servlet mapping set up to the right class. I tested it by changing the servlet-class name, and it errored out. Likewise I changed the URL pattern and it errored out. When running the URL, all I get is a black page. No exception, no stack trace and strangely, the System.out statements I placed within init(config) and service(req,res) too aren't displaying. I also placed the System.out in a static block within the servlet but its not outputting those stmts. Could it be that the problem is within HttpServlet? I placed the System.out stmts before super.init(config) too. How should I debug it. Please help.

thanks.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without seeing your web.xml entry for this servlet and the URL with which you are calling it, it is not clear that you are really addressing the servlet correctly.

Once you are sure that the web.xml is indeed mapping to your servlet, the next step is always to ensure that init() is being called. I would not put any system out println before the super.init() call.

Bill
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the log file if theres any exception.
Once a similar thing happened with me because of the corrupted servlet class file.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first thing I do when I see a blank page is right click on it and view the HTML source. Often the problem is an error in the HTML syntax.

Also, you aren't expecting System.out calls to be printed to the browser, are you?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the code to your servlet?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic