你如何遍历一个String,它是Struts2中一个对象的属性?

时间:2017-03-07 16:30:35

标签: struts2

我有一个Employees.java类

public class EmployeesForm{
    private String name;
         ....
     public String[] getAllTypes() {
            String[] allTypes = new String[3];
            allTypes[0] = "Manager";
            allTypes[1] = "Dev";
            allTypes[2] = "FA";

        return allTypes; 
     }
}

在Struts1中,这是我在allTypes数组中迭代的方式。

<logic:iterate id="type" name="employeesForm" property="allTypes">';
    <option value="<bean:write name=type>" id="typeid_<bean:write name='type'/>">
     <bean:write name="type"/>              
   </option>                        
</logic:iterate>

Struts2中的等价物是什么?我试过了,但它没有用:(

<s:iterator id="type" name="employeesForm" property="allTypes">
    <option value="<s:property value='type'/>" id="typeid_<s:property value='type'/>">
        <s:property value="type"/>
    </option>
</s:iterator>

0 个答案:

没有答案