Questo contenuto non è disponibile nella lingua selezionata.

24.9. Handling Exceptions


When invoking a remote component method, you can specify an exception handler to process the response in the event of an exception during component invocation. To specify an exception handler function, include a reference to it after the callback parameter in your JavaScript:
var callback = function(result) { 
    alert(result); 
}; 
var exceptionHandler = function(ex) { 
    alert("An exception occurred: " + ex.getMessage()); 
}; 
Seam.Component.getInstance("helloAction")
    .sayHello(name, callback, exceptionHandler);
Copy to Clipboard Toggle word wrap
If you do not have a callback handler defined, you must specify null in its place:
var exceptionHandler = function(ex) { 
    alert("An exception occurred: " + ex.getMessage()); 
}; 
Seam.Component.getInstance("helloAction")
    .sayHello(name, null, exceptionHandler);
Copy to Clipboard Toggle word wrap
The exception object that is passed to the exception handler exposes one method, getMessage(), which returns the exception message belonging to the exception thrown by the @WebRemote method.
Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2026 Red Hat