1+ /*
2+ * Licensed to the Apache Software Foundation (ASF) under one
3+ * or more contributor license agreements. See the NOTICE file
4+ * distributed with this work for additional information
5+ * regarding copyright ownership. The ASF licenses this file
6+ * to you under the Apache License, Version 2.0 (the
7+ * "License"); you may not use this file except in compliance
8+ * with the License. You may obtain a copy of the License at
9+ *
10+ * http://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing,
13+ * software distributed under the License is distributed on an
14+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+ * KIND, either express or implied. See the License for the
16+ * specific language governing permissions and limitations
17+ * under the License.
18+ */
19+ package org .apache .struts .examples .parameter ;
20+
21+ import org .apache .struts2 .ActionSupport ;
22+ import org .apache .struts2 .interceptor .parameter .StrutsParameter ;
23+
24+ import java .util .ArrayList ;
25+ import java .util .List ;
26+
27+ public class IndexAction extends ActionSupport {
28+
29+ private final List <User > users = new ArrayList <>();
30+ private Admin admin ;
31+
32+ public String execute () throws Exception {
33+ if (users .isEmpty ()) {
34+ users .add (new User (1 , "Luk" ));
35+ users .add (new User (2 , "Jan" ));
36+ }
37+ if (admin == null ) {
38+ admin = new Admin ("Michal" );
39+ }
40+ return SUCCESS ;
41+ }
42+
43+ @ StrutsParameter (depth = 2 )
44+ public List <User > getUsers () {
45+ return users ;
46+ }
47+
48+ @ StrutsParameter (depth = 2 )
49+ public Admin getAdminUser () {
50+ return admin ;
51+ }
52+
53+ @ StrutsParameter (depth = 2 )
54+ public void setAdminUser (Admin admin ) {
55+ this .admin = admin ;
56+ }
57+ }
0 commit comments