another listShuttle help
renatohonjo Feb 12, 2008 1:55 PMhi...
I'm having some troubles to submit a form with a listShuttle inside.
this is my converter:
public class BeanCooGradeConverter implements Converter {
public Object getAsObject(FacesContext context, UIComponent component,
String value) {
try {
int index = value.indexOf(':');
return new SelectItem(value.substring(0, index), value
.substring(index + 1));
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public String getAsString(FacesContext context, UIComponent component,
Object value) {
try {
SelectItem selectItem = (SelectItem) value;
return selectItem.getValue() + ":" + selectItem.getLabel();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
this is my jsf-config.xml:
... <managed-bean> <managed-bean-name>BeanCooGrade</managed-bean-name> <managed-bean-class>jsf.bean.BeanCooGrade</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> <managed-bean> <managed-bean-name>BeanCooGradeConverter</managed-bean-name> <managed-bean-class>jsf.converter.BeanCooGradeConverter</managed-bean-class> <managed-bean-scope>application</managed-bean-scope> </managed-bean> ...
this is my jsp:
<rich:listShuttle sourceValue="#{BeanCooGrade.disciplinasFonte}"
targetValue="#{BeanCooGrade.disciplinasDestino}" var="item"
sourceCaptionLabel="Disciplinas disponÃÂÂÂveis"
targetCaptionLabel="Disciplinas da grade"
copyAllControlLabel="Adicionar todas" copyControlLabel="Adicionar"
removeAllControlLabel="Remover todas" removeControlLabel="Remover"
orderControlsVisible="false" fastOrderControlsVisible="false"
converter="#{BeanCooGradeConverter}">
<rich:column>
<h:outputText value="#{item.label}"></h:outputText>
</rich:column>
</rich:listShuttle>
as you can see, my "item" in the listShuttle ia a SelectItem bean...
this is the warning generated by the commandButton click...
INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed. sourceId=j_id_jsp_1122326479_1:j_id_jsp_1122326479_14[severity=(ERROR 2), summary=(j_id_jsp_1122326479_1:j_id_jsp_1122326479_14: Validation Error: Value javax.faces.model.SelectItem@a6a21a is not valid), detail=(j_id_jsp_1122326479_1:j_id_jsp_1122326479_14: Validation Error: Value javax.faces.model.SelectItem@a6a21a is not valid)]
obs: the action in the managed bean in never called... :/
thanks.