*
The moose likes JSF and the fly likes How to show error message when internet/server/vpn is not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to show error message when internet/server/vpn is not available" Watch "How to show error message when internet/server/vpn is not available" New topic
Author

How to show error message when internet/server/vpn is not available

Ziaur Rahman
Greenhorn

Joined: Feb 08, 2011
Posts: 4
I have a code something goes like this;

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?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to show error message when internet/server/vpn is not available
 
Similar Threads
Action class error problem
Re : JSF1.2 application working slow on Apache tomcat7.0.12
chat server
Control the execution order in jsf
execute javascript after action?