I'm using a standard form/action to post to a restful web service, I'm trying not to use ajax due to the size and makeup of the form. Is there a way to attach error handling to the form submission? See my current code below.
<form id="theForm"
action="rest/url"
method="post"
enctype="multipart/form-data">
</form>
$("#theForm").submit(function(e){
// Can anything be done to handle 500s here?
});
Here's the rest service.
@POST
@Path("/save")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void save(
@FormDataParam("iD") Integer iD,
....
@FormDataParam("file") InputStream inputStream,
@FormDataParam("file") FormDataContentDisposition fileDetail
{
// void to avoid redirect
// exceptions return 500
throw new ServerException(500);
}