01: /*
02: * Copyright 2005-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
05: * in compliance with the License. You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * Unless required by applicable law or agreed to in writing, software distributed under the License
10: * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11: * or implied. See the License for the specific language governing permissions and limitations under
12: * the License.
13: */
14:
15: package org.strecks.actiontest.actions;
16:
17: import org.apache.struts.util.MessageResources;
18: import org.strecks.action.BasicSubmitAction;
19: import org.strecks.action.basic.BasicLookupDispatchController;
20: import org.strecks.controller.annotation.Controller;
21: import org.strecks.dispatch.annotation.DispatchMethod;
22: import org.strecks.injection.annotation.InjectMessageResources;
23:
24: /**
25: * @author Phil Zoio
26: */
27: @Controller(name=BasicLookupDispatchController.class)
28: public class ExampleBasicLookupSubmitAction implements
29: BasicSubmitAction {
30:
31: private String message;
32:
33: private MessageResources resources;
34:
35: public void preBind() {
36: }
37:
38: public String execute() {
39: message = "Ran execute() method in "
40: + ExampleBasicLookupSubmitAction.class;
41: return "success";
42: }
43:
44: @DispatchMethod(key="button.add")
45: public String insert() {
46: message = "Ran insert() method linked to key '"
47: + resources.getMessage("button.add") + "' from "
48: + ExampleBasicLookupSubmitAction.class;
49: return "success";
50: }
51:
52: @DispatchMethod(key="button.delete")
53: public String delete() {
54: message = "Ran delete() method linked to key '"
55: + resources.getMessage("button.delete") + "' from "
56: + ExampleBasicLookupSubmitAction.class;
57: return "success";
58: }
59:
60: public String cancel() {
61: message = "Ran cancel() method";
62: return "success";
63: }
64:
65: public String getMessage() {
66: return message;
67: }
68:
69: @InjectMessageResources
70: public void setResources(MessageResources resources) {
71: this.resources = resources;
72: }
73:
74: }
|