我使用了带有预选值的下拉选项和另外两个选项,但是当我选择其他选项并打印相同的预选值时会被打印 这是我的代码
public class MainPanel extends Panel {
public String Vehicle= "Bike";
public MainPanel(String id)
{
super(id);
final Form<?> form= new Form<Void>("userForm");
add(form);
final List<String> VEHICLES = Arrays.asList(new String[] {"Bike", "car", "Both" });
final DropDownChoice<String> listSites = new DropDownChoice<String>(
"dropdwn", new PropertyModel<String>(this,"Vehicle"),VEHICLES);
listSites.setRequired(true);
form.add(listSites);
}
public String getVehicle()
{
return Vehicle;
}
public void setVehicle(String Vehicle)
{
this.Vehicle= Vehicle;
}
}
任何人都可以帮我解决这个问题。