File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes forward() in Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "forward() in Servlets" Watch "forward() in Servlets" New topic
Author

forward() in Servlets

amit sanghai
Ranch Hand

Joined: Dec 05, 2000
Posts: 231
Suppose one servlet forwards a request to another servlet, and the second servlet in turn forwards the request to the first servlet, will it result to an infinite loop? What should I do to avoid this?
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
exactly...it would do the same as you said it.
But what exactly are you trying to do...??
Please pass on some more info..
cheers
MB


Malhar Barai
SOA & Java Book
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

What should I do to avoid this?

Well, the simple answer is: Don't do that!
In the same way you must guard against creating infinite loops in code -- especially when using recursion -- if you have such a situation where it is possible for your servlets to get stuck in this way (I'd also argue that such a situation merits sitting back and pondering whether your design needs some rethinking), you need to place safeguards into the code to make sure that you never get into an inifinite-forward loop.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: forward() in Servlets