Not quite what I expected…JSF & Validation

public void validateQueryString(FacesContext context, UIComponent toValidate, Object value) {
String queryString = (String) value;
if (queryString == null || queryString.trim().length()<1){
((UIInput) toValidate).setValid(false);
FacesMessage message = new FacesMessage("I'm sorry, I can't make something from nothing...please enter a search string");
context.addMessage(toValidate.getClientId(context), message);
}
}

--

--

--

Husband and Father. Wilderness First-Aid Certified. Terrible at tying knots. I play Squash. I like things that Trade. Leafs fan. FRC and Scouts Canada

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

A quick look at Autoclosures

Create your Map from your Zwift activity

Cloud computing cheat sheet

How to Reverse a Linked List Recursively -> and it’s applications

Auto deploying Sphinx theme documentation site using Travis CI

September 2021 - Personal Invites and RadBots

Creating a Transparent Window Effect in Unity

AWS CloudFormation Versus HashiCorp Terraform: How to Choose the Best for Your Business

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jamie McIlroy

Jamie McIlroy

Husband and Father. Wilderness First-Aid Certified. Terrible at tying knots. I play Squash. I like things that Trade. Leafs fan. FRC and Scouts Canada

More from Medium

Publish a book in a day?

CS371p Spring 2022 Blog Wk 10 : Cristian Astorga

Inline function vs function passed by value in React.

Why I do not want to be an activist (yet)