I am trying to put a Map<String, Object>
into a dropdown and I'm having issues with it. What is happening is the list is being generated with my objects, and the drop down will just show me pointers to the objects, If the code is like this.
<s:select name="form.Clause" list="Clause" label="%{getText('Clause')}" requiredLabel="true" required="true" />
This will fill my select with object references. Although if I do this
<s:select name="form.Clause" list="Clause" listValue="%{Clause.{clause}}" Value="%{Clause.{clause}}" label="%{getText('Clause')}" requiredLabel="true" required="true" />
This will fill the list with the proper values except it prints everything in the list in every selection.
<select name="form.Clause" id="frm_form_Clause" data-wet_aria_input="true" aria-describedby="frm_form_Clause_error" aria-required="true" Value="[(A), (B), (A), (B), (C), (A), (B), (A), (B), (A)]" required="true">
<option value="1">[(A), (B), (A), (B), (C), (A), (B), (A), (B), (A)]</option>
<option value="2">[(A), (B), (A), (B), (C), (A), (B), (A), (B), (A)]</option>
<option value="3">[(A), (B), (A), (B), (C), (A), (B), (A), (B), (A)]</option>
<option value="4">[(A), (B), (A), (B), (C), (A), (B), (A), (B), (A)]</option>
<option value="5">[(A), (B), (A), (B), (C), (A), (B), (A), (B), (A)]</option>
<option value="6">[(A), (B), (A), (B), (C), (A), (B), (A), (B), (A)]</option>
<option value="7">[(A), (B), (A), (B), (C), (A), (B), (A), (B), (A)]</option>
<option value="8">[(A), (B), (A), (B), (C), (A), (B), (A), (B), (A)]</option>
<option value="9">[(A), (B), (A), (B), (C), (A), (B), (A), (B), (A)]</option>
<option value="10">[(A), (B), (A), (B), (C), (A), (B), (A), (B), (A)]</option>
Which is closer but still incorrect, as I am looking for the options to look like this.
<option value="1">(A)</option>
<option value="2">(B)</option>
<option value="3">(A)</option>
<option value="4">(B)</option>
<option value="5">(C)</option>
<option value="6">(A)</option>
<option value="7">(B)</option>
<option value="8">(A)</option>
<option value="9">(B)</option>
<option value="10">(A)</option>
Is there some way to make this possible?
The
.{}
inClause.{clause}
is called a projection in OGNL and it creates a list of properties of that object. That is why you get all values in option tag.Usually you should put just property name in
listValue
attribute but in your case you need to get value from map value then reference it like thatvalue.property_of_object