Forums Register Login
SelectManyListbox converter problem
I have a SelectManyListbox with a custom converter for my TestCase class. I can set the SelectItem to properly accept a TestCase object with a label. I know that because the listbox displays properly. This means that the overridden Converter.getAsString method is doing its job. The problem comes when I submit the form. Normally, the setter method of a bean's array/arrayList would be called when the form is submitted. But in my case, it doesn't get invoked. Thus, my backing bean TeseCase array/ArrayList doesn't get populated. What's strange is that there are no errors or exceptions thrown either. Has anyone come across this problem before that can give me some pointers?

Thanks in advance.

Here's the Converter class:

public class TestCaseConverter implements Converter {

public Object getAsObject(FacesContext arg0, UIComponent arg1, String testCaseString)
throws ConverterException {
if (StringUtils.isEmpty(testCaseString)) {
return null;
System.out.println("*********************IN GETASOBJECT: "+ testCaseString + " *****************");

int descriptionIndex = testCaseString.indexOf("description");
int beginDescriptionIndex = testCaseString.indexOf("\"", descriptionIndex);
int endDescriptionIndex = testCaseString.indexOf("\"", beginDescriptionIndex+1);
String testcaseDescription = testCaseString.substring(beginDescriptionIndex+1, endDescriptionIndex);
return new TestCase(testCaseString, testcaseDescription);

public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2)
throws ConverterException {
return arg2.toString();


Here's the TestCase class:

public class TestCase {
private String description;
private String xmlForm;

public TestCase() {
description = null;
xmlForm = null;

public TestCase(String xml, String desc) {
xmlForm = xml;
description = desc;

public String getDescription() {
return description;

public void setDescription(String desc) {
description = desc;

public String getXmlForm() {
return xmlForm;

public void setXmlForm(String xml) {
xmlForm = xml;

public String toString() {
return xmlForm;


Here's the JSP:

<h:form id="testCaseListForm" rendered="#{InputFileParserBean.testCaseListFilled}">
<h:panelGrid columns="2">
<tutputText value="Test Cases"/>
<h:selectManyListbox id="testCaseList" value="#{RunTestcaseBean.selectedTestcases}"
required="true" >
<f:selectItems value="#{InputFileParserBean.testCaseList}"/>
<t:commandButton action="#{RunTestcaseBean.runTestcases}"
value="Run Test"/>
Hi XiaoPeng,

Welcome to the ranch! We've found that if people use their real first AND last names, things stay friendlier, so I'd ask you to update your display name to match that policy.


Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards

This thread has been viewed 3699 times.

All times above are in ranch (not your local) time.
The current ranch time is
Mar 21, 2018 01:29:00.