How to receive a list of Strings in a Struts2 select?

Asked

Viewed 299 times

3

I have a select on my page that should have its value and caption populated through a list of Strings that come from my Action.

I am sending the list correctly, because I see the combo have the number of elements of the same size as the list, but I do not know how to identify the value and description in Taglib.

<s:select name="status" list="status" headerKey="" headerValue="-- Selecione --" id="statusMedico" listKey="" listValue="" />

What should I use in listKey and listValue to popular the options?

The method in action:

public List<String> getStatus() {
    return Arrays.asList("Ativo", "Inativo");
}
  • 2

    I don’t know much about Trouts. See if this link helps you: http://www.mkyong.com/struts2/struts-2-sselect-drop-down-box-example/. This japa is fera.

  • Thank you, @Edgarmunizberlinck. But the answer is only to remove attributes listKey and listValue.

1 answer

2

Browser other questions tagged

You are not signed in. Login or sign up in order to post.