In a bit of situation and I am sure some (most) of you will sympathise. A senior developer at work decided to leave weeks before a release and I have been handed an almost complete interface written in JSF using Primefaces. I am relatively new to Java, around 6 months experience and even newer to JSF, around 4 weeks exposure. I come from a C++ background so I know programming, but with a deadline fast approaching I am having issues doing some very simple things. If anyone can give some advice or point me in the right direction it would be greatly appreciated.
Basically the tool I have is an Administrator interface that talks to a JAR that I wrote which in turn connects to SQL Server to perform administration on the database. Most of the development is done there is just a few usability issues I need to implement. What I mainly need to know is the following:
If I can get this error reporting working I will fix 90% of the problems I have as everything just fails silently at the moment.
It's a trivial matter in JSF to ensure that a form isn't submitted with blank items in it. Just put the 'required="true"' attribute on the controls where mandatory input is required. You can use the 'h:messsages for=' element to display the message, and either use the generic built-in message, or supply a field-specific message.
"required=" works on most controls. SelectionOneMenuItem checks to make sure that the value of the selection isn't null/empty string. Boolean true/false checkboxes don't support it because there's an implied entry of a value (if you don't check it, it's false). Radio buttons can't be missing a required value as long as one of the buttons in the group was selected before the view was displayed. In generally, it does what most people would like it do do.
A bigger issue that most people have is when an item is only required when certain other elements on the form are populated. That's one of our more popular questions.
JSF is designed to avoid passing incomplete or corrupt data to the action processor (and from there to the backend), so it provides quite a bit of support for "up-front" validation and reporting validation failures.
I'm going to be a "small government" candidate. I'll be the government. Just me. No one else.
The best way of validating form input is to enclose the inputText statements in a panelGrid.
Allow one paneGrid per component to allow for components that render in more than one
column like a selectBooleanCheckbox.
Allow columns=3, for example outputLabel = 1 + inputText = 1 + h:message = 1
== 3. The h:message component would need to use for=id to connect to the component
in question. For messages that are not connected to a single component the h:messages
(note the plural) will display potentially multiple messages, but you need to manage the
space on the page.
Sorry if I've missed your moment in need, good luck,