• Post Reply Bookmark Topic Watch Topic
  • New Topic

Piotr's mock exam question 63

 
Himai Minh
Ranch Hand
Posts: 1400
8
  • 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: 1400
8
  • 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: 1400
8
  • 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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!