I am using struts2 as MVC framework,but i had an issue,my problem is in Action,I defined a model which called "Company",Its definition is as following:
class Company
{
private String name;
private String address;
...
private List<Staff>staffs;
...
}
class Staff
{
private String name;
private int age;
....
}
The Action is as following
class Action
{
private Company company;
public String execute(){
}
}
How to show the whole company and staff info in view(The view is JSP file) ?what i expected in UI is:
Company info
company name company address...
Staff 1 info
staff name staff age...
Staff 2 info
staff name staff age...
How to define the jsp file?even though company info could be shown by using OGNL,but how about staff info,As it is a List and its number is uncertain
Someone told me i could use iterator,but my requirement is: Beside show the staff infomation in UI,I also hope to let the staff could be editable,e.g maybe i will define "form" as following
<s:form>
Company info: Company Name:<s:input name="company.name"/> Company Address:<s:input name="company.name"/>
Staff 1 info: ....
Staff 2 info: ...
<s:form>
Is it possible to define the staff info with "form" or "input"?