• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Piotr's mock exam question 63

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I modified NullServlet2 like this :

But I got this:
java.lang.StackOverflowError
org.apache.catalina.connector.Request.setAttribute(Request.java:1455)
org.apache.catalina.connector.RequestFacade.setAttribute(RequestFacade.java:539)
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi, after I modified NullServlet 1, it prints value of Hello from nullservlet 9 is world.
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




This code will keep printing "Phew , that was a ride" and "Value of Hello from nullservlet 9 is world" again and again.

To solve this problem, I change NullServlet2 into :

This will stop the infinite loop. It prints the "Phew that was a ride" and "Value of Hello from nullservlet 9 is world" only once as well as the text in the page.html.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic