Quantcast
Channel: Active questions tagged servlets - Stack Overflow
Viewing all articles
Browse latest Browse all 675

Why does a java servlet retain bad form entries?

$
0
0

We have a special search page in a java web app running on a Tomcat 9 server. The page uses a form with a few <input> tags of type "text". During some testing I was doing, I found a strange occurrence:

I input some text in one of the text boxes and it causes an error in the java code--it then runs the code in the catch block. After executing that code and returning the response to the servlet, it shows the expected error page. However, if I leave the page and come back to it in any way, it still shows the error page! I could even exit the application (leaving Tomcat running) and reenter, and it would still show the same error page. When we had it deployed on a shared test server, other users would also see the same error page if they tried to access the search page. When I restart Tomcat, the error page would not immediately appear on the search page (until I test the bad entry in a text box again).

We handled it by clearing out the text boxes in the form in the catch block.

My question is why does the servlet retain those values entered? Or is it a Tomcat thing?


Viewing all articles
Browse latest Browse all 675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>