public class Test {
private String gender;
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public void onSuccess() {
System.out.println(gender);
}
}
in the template:
<input t:type="select" t:id="gender" model="'M,F'"/>
above code works, however it drops down a list of "M" and "F", not so informative, let's change so that it shows 'Male' and 'Female' to the user, but value returned in the variable gender is still single char:
just add a hashmap in the above class:
private HashMap
public Test(String gender) {
genderModel = new HashMap
genderModel.put("M", "Male");
genderModel.put("F", "Female");
}
in the template:
<input t:type="select" name="gender" t:id="gender" model="genderModel" t:value="gender" />
1 comment:
I haven't try it, just get back from Tap 5 Milist. So, this is just what I need
I'll report as soon as I am succeed
Thanks pal!!
Post a Comment