Great, thank you very much it works perfectly. I did not know that
object returned by the model and the type of objects in the list *must*
be the same.
Serkan Camurcuoglu wrote / napísal(a):
why does it say java.lang.String instead of DaysSelectOption? On
http://cwiki.apache.org/WICKET/dropdownchoice-examples.html it says:
"You give a DDC a model and a list of possible values. The type of
object returned by the model and the type of objects in the list
*must* be the same. If your model returns an Integer, so you *must*
pass a list of Integers, not IntegerSelectChoice or anything else.
If you want to display something different than the integer, you have
to implement some custom code in ChoiceRenderer.getDisplayValue().
Don't get hung up on the idea that the value returned has to be a
property of
the objects in your list. It can be anything, such as the
getString("period_" + object.toString()), for example."
Vladimir Zavada wrote:
I have changed it to public and still the same error.
James Carman wrote / napísal(a):
The class is private.
2009/4/8 Vladimir Zavada <[email protected]>:
Hi,
I have a problem with DropDownChoice. I am using DropDownChoice with
ChoiceRenderer and I am getting this error:
No get method defined for class: class java.lang.String expression:
key
Here is a code:
DaysSelectOption[] options = new DaysSelectOption[] {new
DaysSelectOption("&", "AND"), new DaysSelectOption("|", "OR")};
ChoiceRenderer choiceRenderer = new ChoiceRenderer("value",
"key");
showVal.add(new DropDownChoice("day_val", new
PropertyModel(this,
"items"), Arrays.asList(options), choiceRenderer));
where class DaysSelectOption is:
private class DaysSelectOption
{
private String key;
public String getKey()
{
return key;
}
public void setKey(String key)
{
this.key = key;
}
public String getValue()
{
return value;
}
public void setValue(String value)
{
this.value = value;
}
private String value;
public DaysSelectOption(String key, String value)
{
this.key = key;
this.value = value;
}
thx for asnwers
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
he class is private.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]