File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Intermittent problem blank html page being displayed

 
Daniel Ralphs
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, im quite new to the java language and i have been doing an assignment to make a simple game that allows a user to enter a word on a jsp page and sends the users input to the servlet and match it against a random word generated.

Anyway i have come across this bug where when a word is submitted by the user the response generated by the servlet is just a blank html page with no source code or anything. The strange thing is it does not happen all the time.

Any help you can give me regarding this bug would be greatly appreaciated as this bug is starting to slowly drive me insane .


[ December 21, 2008: Message edited by: Daniel Ralphs ]
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Daniel Ralphs:
Hi, im quite new to the java language and iv been doing an assignment to make a simple game that allows a user to enter a word on a jsp page and sends the users input to the servlet and match it against a random word generated.
What is it, 'iv' ? Please write words full out. You're here at an international forum where proper English is expected. I for one am not native English, so I -as many others- wouldn't understand quickly the meaning of childish/sms/chat talk.

Anyway iv come across this bug where when a word is submitted by the user the response generated by the servlet is just a blank html page with no source code or anything. The wierd thing is it doesnt happen all the time.
Don't you see anything in the appserver's logs either?


Any help you can give me regarding this bug would be greatly appreaciated as this bug is starting to slowly drive me insane .


Only thing what I can tell about this is that you shouldn't be mingling presentation logic with controller/business logic. Use JSP for presentation. This might also clear up the cause of the problem or even solve it.
[ December 21, 2008: Message edited by: Bauke Scholtz ]
 
Daniel Ralphs
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have edited my previous post now and i have changed it sorry for the confusion.

Don't you see anything in the appserver's logs either?


I am running the servlet through the netbeans ide using the tomcat server, in the log i get this message.

SEVERE: Servlet.service() for servlet counter threw exception
java.lang.StringIndexOutOfBoundsException: String index out of range: 8
at java.lang.String.charAt(String.java:687)
at counter.counter.letterMatchCount(counter.java:135)
at counter.counter.processRequest(counter.java:45)
at counter.counter.doPost(counter.java:88)

I did not see that error message before, i was only looking in the main run log.

[ December 21, 2008: Message edited by: Daniel Ralphs ]
[ December 21, 2008: Message edited by: Daniel Ralphs ]
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Daniel Ralphs:
I am running the servlet through the netbeans ide using the tomcat server, in the log i get this message.

SEVERE: Servlet.service() for servlet counter threw exception
java.lang.StringIndexOutOfBoundsException: String index out of range: 8
at java.lang.String.charAt(String.java:687)
at counter.counter.letterMatchCount(counter.java:135)
at counter.counter.processRequest(counter.java:45)
at counter.counter.doPost(counter.java:88)

I did not see that error message before, i was only looking in the main run log.

Great, now you have found the cause of the problem. Fix it accordingly.

About the blank page; you already wrote to the response inside the servlet (instead of using JSP), thus the web container can't change it anymore to give you the standard error page with the details about the exception like you got in the logs. If you was using JSP for presentation, you would have noticed it much earlier.
[ December 21, 2008: Message edited by: Bauke Scholtz ]
 
Daniel Ralphs
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever you get a blank page like that, chances are close to 99.9999999999% that there's been an exception thrown.
 
Daniel Ralphs
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem now fixed thanks for the help
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic