public FormValidation doCheckName(@QueryParameter String value)
throws IOException, ServletException {
if (value.length() == 0)
return FormValidation.error("Please set a name"); (1)
if (value.length() < 4)
return FormValidation.warning("Isn't the name too short?"); (2)
return FormValidation.ok();
}
...
/**
* This human readable name is used in the configuration screen.
*/
public String getDisplayName() {
return "Say hello world"; (3)
}
@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
// To persist global configuration information,
// set that to properties and call save().
useFrench = formData.getBoolean("useFrench"); (4)
// ^Can also use req.bindJSON(this, formData);
// (easier when there are many fields; need set* methods for this, like setUseFrench)
save();
return super.configure(req,formData);
}