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

Benefits of Migrating a Physical Server to Azure

How I Learned Programming in Ten Short Years, Thanks to Peter Norvig

DBMS Part-10 — Integrity Constraints in SQL

Always Listening, Always Understanding.

Six Important Facts to Prefer Codefresh for Microservices CI/CD Automation

Start a JAVA service from JAR on an Ubuntu instance

Working with lerna and yarn workspaces in WSL

Displaying pyramid pattern using python

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

Here is why I started writing (and why you should too)

An Ode to a Dot…

Michael Newton on Suicide

It isn’t just a hobby!