01: /*
02: * $Id: ListPeopleAction.java 476710 2006-11-19 05:05:14Z mrdon $
03: *
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
20: */
21: package org.apache.struts2.showcase.person;
22:
23: import java.util.ArrayList;
24: import java.util.List;
25:
26: import org.apache.struts2.config.Result;
27: import org.apache.struts2.views.freemarker.FreemarkerResult;
28:
29: import com.opensymphony.xwork2.ActionSupport;
30:
31: public class ListPeopleAction extends ActionSupport {
32:
33: private static final long serialVersionUID = 3608017189783645371L;
34:
35: PersonManager personManager;
36: List people = new ArrayList();
37:
38: public void setPersonManager(PersonManager personManager) {
39: this .personManager = personManager;
40: }
41:
42: public String execute() {
43: people.addAll(personManager.getPeople());
44:
45: return SUCCESS;
46: }
47:
48: public List getPeople() {
49: return people;
50: }
51:
52: public int getPeopleCount() {
53: return people.size();
54: }
55:
56: }
|