listShuttle Error "has invalid value expression"
tiger86 Sep 2, 2010 2:25 AMHi
i have some problem with listShuttle
i get this error messages
listShuttle Component mainform:j_id36 has invalid value expression
when i click on the command button to submit, i am not able to fetch the target value of listShuttle
actually it didn't call the method it stop to that error
configureStep.xhtml:
ConfigureStep.java
public class ConfigureStep extends Step<ConfigureSettingsWizard> {
/* Initial */
private ConfigurationSettings configurationSettings;
/* Statistics Live Settings */
private int period;
/* Prohibited Professions Settings */
private List<MySelectItem> prohibitedProfessionsListItem = new ArrayList<MySelectItem>();
private List<MySelectItem> nonProhibitedProfessionsListItem = new ArrayList<MySelectItem>();
public ConfigureStep(ConfigureSettingsWizard wizard) {
super(wizard, "form_configure_settings_title");
}
public void onConfigurationSettings() {
try {
ConfigureSettingsHelper helper = new ConfigureSettingsHelper();
if (configurationSettings.equals(ConfigurationSettings.STATISTICS_LIVE_SETTINGS)) {
String periodStr = helper.getLiveStatisticsPeriod(Login.getLoggedInUser());
if (periodStr != null && !periodStr.equals("")) {
period = Integer.parseInt(periodStr);
}
} else if (configurationSettings.equals(ConfigurationSettings.PROHIBITED_PROFESSIONS_SETTINGS)) {
// List of prohibited Profession Codes
List<String> prohibitedProfessionCodes = helper.getProhibitedProfessionsList(Login.getLoggedInUser());
CodeManagementHelper codeManagementHelper = MasterDataHelper.init();
Map<String, String> professions = null;
// Map of professions
professions = codeManagementHelper.getAllMaleProfession();
if (prohibitedProfessionCodes != null) {
for (String prohibitedProfessionCode : prohibitedProfessionCodes) {
prohibitedProfessionsListItem.add(new MySelectItem(prohibitedProfessionCode, professions
.get(prohibitedProfessionCode)));
professions.remove(prohibitedProfessionCode);
}
}
if (professions != null) {
for (String profession : professions.keySet()) {
nonProhibitedProfessionsListItem.add(new MySelectItem(profession, professions.get(profession)));
}
}
}
} catch (RPSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public ConfigurationSettings getConfigurationSettings() {
return configurationSettings;
}
public void setConfigurationSettings(ConfigurationSettings configurationSettings) {
this.configurationSettings = configurationSettings;
}
public int getPeriod() {
return period;
}
public void setPeriod(int period) {
this.period = period;
}
public List<MySelectItem> getProhibitedProfessionsListItem() {
return prohibitedProfessionsListItem;
}
public void setProhibitedProfessionsListItem(List<MySelectItem> prohibitedProfessionsListItem) {
this.prohibitedProfessionsListItem = prohibitedProfessionsListItem;
}
public List<MySelectItem> getNonProhibitedProfessionsListItem() {
return nonProhibitedProfessionsListItem;
}
public void setNonProhibitedProfessionsListItem(List<MySelectItem> nonProhibitedProfessionsListItem) {
this.nonProhibitedProfessionsListItem = nonProhibitedProfessionsListItem;
}
}
ListConverter.java
public class ListConverter implements Converter {
public ListConverter() {
}
public Object getAsObject(FacesContext arg0, UIComponent arg1, String value) {
if (value != null && !value.equals("") && value.contains(":")) {
String[] values = value.split(":");
String id = values[0].trim();
// System.out.println(id);
String name = values[1].trim();
// System.out.println(name);
return new MySelectItem(id, name);
}
return new MySelectItem();
}
public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
if (arg2 != null) {
return arg2.toString();
}
return null;
}
}
MySelectItem.java
public class MySelectItem implements Serializable {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/** The value. */
private String value;
/** The label. */
private String label;
/** The display order. */
private int displayOrder;
/**
* Instantiates a new list item.
*/
public MySelectItem() {
super();
}
/**
* Instantiates a new list item.
*
* @param value
* the value
*/
public MySelectItem(String value) {
super();
this.value = value;
}
/**
* Instantiates a new list item.
*
* @param value
* the value
* @param label
* the label
*/
public MySelectItem(String value, String label) {
super();
this.value = value;
this.label = label;
}
/**
* Gets the value.
*
* @return the value
*/
public String getValue() {
return value;
}
/**
* Sets the value.
*
* @param value
* the new value
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets the label.
*
* @return the label
*/
public String getLabel() {
return label;
}
/**
* Sets the label.
*
* @param label
* the new label
*/
public void setLabel(String label) {
this.label = label;
}
/**
* @return the displayOrder
*/
public int getDisplayOrder() {
return displayOrder;
}
/**
* @param displayOrder
* the displayOrder to set
*/
public void setDisplayOrder(int displayOrder) {
this.displayOrder = displayOrder;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + displayOrder;
result = prime * result + ((label == null) ? 0 : label.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
/**
* Equals.
*
* @param obj
* the obj
*
* @return true, if equals
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final MySelectItem other = (MySelectItem) obj;
if (label == null) {
if (other.label != null)
return false;
} else if (!this.label.equals(other.label))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!this.value.equals(other.value))
return false;
return true;
}
/**
* To string.
*
* @return the string
*
* @author
*/
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append(value);
buffer.append(":");
buffer.append(label);
return buffer.toString();
}
}