Here, when my VPN is down, my oncomplete event has jscript function confirmOperation(), which gets executed and undesired output from that fuction is being displayed. But, what I ultimately want is, when I click the button, I want to check whether I can able to connect to the server(VPN/internet enabled or not), and if not I have to show some error message like 'Unable to reach server' or else, can I redirect the page to login page?
Well, from a purely pedantic point of view, backing beans are not Controllers, they are Models, and I never recommend using an actionListener when a simple action method will do (Neither of them are MVC Controller methods, however).
The problem with checking network availability is that the network can bounce up and down at any moment, so past performance is no guarantor of future results.
For the particular case where you want to see if the user is logged into a VPN, however, your best approach is to add an onclick or onsubmit method that does an AJAX call to some resource that's only available when the user is logged in, and cancelling the submit, displaying a dialog, in the event that the user is not logged in.
Actually, for a VPN, AJAX may not be strictly necessary, since you probably can detect for the presence or absence of VLAN file shares or other resources.
An IDE is no substitute for an Intelligent Developer.