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.NavigableSubmitAction;
19: import org.strecks.action.navigable.NavigableLookupDispatchController;
20: import org.strecks.controller.annotation.Controller;
21: import org.strecks.dispatch.annotation.DispatchMethod;
22: import org.strecks.injection.annotation.InjectMessageResources;
23: import org.strecks.navigate.annotation.NavigateForward;
24:
25: /**
26: * @author Phil Zoio
27: */
28: @Controller(name=NavigableLookupDispatchController.class)
29: public class ExampleNavigableLookupSubmitAction implements
30: NavigableSubmitAction {
31:
32: private String message;
33:
34: private MessageResources resources;
35:
36: public void preBind() {
37: }
38:
39: public void execute() {
40: message = "Ran execute() method "
41: + ExampleNavigableLookupSubmitAction.class;
42: }
43:
44: @DispatchMethod(key="button.add")
45: public void insert() {
46: message = "Ran insert() method linked to key '"
47: + resources.getMessage("button.add") + "' from "
48: + ExampleNavigableLookupSubmitAction.class;
49: }
50:
51: @DispatchMethod(key="button.delete")
52: public void delete() {
53: message = "Ran delete() method linked to key '"
54: + resources.getMessage("button.delete") + "' from "
55: + ExampleNavigableLookupSubmitAction.class;
56: }
57:
58: public void cancel() {
59: message = "Ran cancel() method "
60: + ExampleNavigableLookupSubmitAction.class;
61: }
62:
63: @NavigateForward
64: public String getResult() {
65: return "success";
66: }
67:
68: public String getMessage() {
69: return message;
70: }
71:
72: @InjectMessageResources
73: public void setResources(MessageResources resources) {
74: this.resources = resources;
75: }
76:
77: }
|