Search code examples
javajspstruts2ognl

select tag with two lists of same type in Struts 2


I am using Struts 2 in that I have requirement I have to populate two different lists of same type as a dropdown box

Is it possible in Struts 2?

Demo code something like this:

<s:select list="{list1 , list2}" value="" />

Lists contain the same type of VO but with different data.


Solution

  • First of all: you are better of doing that kind of things in action class not in JSP.

    In JSP you can use <s:append> tag.

    <s:append var="appendedLists">
      <s:param value="list1" />
      <s:param value="list2" />
    </s:append>
    
    <s:select list="#appendedLists" value="" />