I want to use JAX-RS REST services as the background for a web application used directly by people with browsers. Since people make mistakes from time to time, I want to check the form input and re-display the form with a validation message if something is wrong. By default, JAX-RS sends a 400 or 404 status code if all or incorrect values have not been sent.
Say, for example, the user entered the field "xyz" in the form field "count":
@POST public void create(@FormParam("count") int count) { ... }
JAX-RS was unable to convert "xyz" to int and returns "400 Bad Request".
How can I tell the user that he entered an invalid value in the "count" field? Is there anything more convenient than using strings all over the world and doing a conversation manually?
java validation forms jax-rs
deamon
source share