On 11/20/2017 5:00 PM, [email protected] wrote:
> <s:select name='student'
> list="students" listKey="sid" listValue="name"
> value="defaultStudent.equals('true')"
> />
>
> I have a select tag as above. The Student object has a boolean value
> defaultStudent with getter isDefaultStudent. How to pre-select the default
> student based on this boolean value. Value accepts only static value, not
> condition.
I think this approach would work:
IN YOUR ACTION
public Integer getDefaultStudentId() {
foreach(Student s : students) if(s.isDefaultStudent()) return s.getId();
return -1;
}
IN YOUR JSP
<s:select ... value="defaultStudentId" ...
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]