There are a couple of potential responses, depending on the technology stack you are using:
With JSF, you can use some of the f: tags to force an explicit conversion for the h:input fields.
If it is a custom type and needs to be converted every time, I recommend registering a bean for the type that tells web flow to use the converter for the type every time a form is submitted. For example:
PHP Code:
public class ApplicationConversionService extends DefaultConversionService {
public ApplicationConversionService() {
addDefaultConverters();
addDefaultAliases();
addConverter("customConverter", new CustomConverter());
}
}
This can also be done in an old way with XML bean registrations, but I can't seem to find an example of it since it is rarely used now.
To create a custom converter, you'll need to use the JSF template as detailed with this link:
PHP Code:
public class CustomConverter
public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String param) {
// Take the String and look it up in the database to get an object representation
}
public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object obj) {
// Convert `obj` and pull out the relevant information to turn it into a String
}
}