I do not want every time using:
if(!new File(file).exists()){
//createFile /doc/a.txt ...
}
request.getRequestDispatcher("/doc/a.txt").forward(request, response);
I would like to know how can i implement the following code:
try{
request.getRequestDispatcher("/doc/a.txt").forward(request, response);
}catch(404 error){
//createFile /doc/a.txt ...
}
How can I handing 404 error just in this page?
Thanks a lot for any suggestion.
This is best handled by an error section in your
web.xml: