
2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18


















































2

3

4

5


6

7

8

9

10



11

12

13

14

15


16

17

18

19

20



21

22

23

24

WebWork文檔中的例子
<form action="MyAction.action">
<input type="submit" name="buttonOnePressed" value="First option">
<input type="submit" name="buttonTwoPressed" value="Alternative Option">
</form>
public class MyAction extends Action {
/**
* Action implementation
*
* Sets the message according to which button was pressed.
**/
public String execute() {
if (buttonOnePressed) {
message="You pressed the first button";
} else if (buttonTwoPressed) {
message="You pressed the second button";
} else {
return ERROR;
}
return SUCCES;
}
// Input parameters
private boolean buttonOnePressed=false;
private boolean buttonTwoPressed=false;
public void setButtonOnePressed(boolean value) {
this.buttonOnePressed = value;
}
public void setButtonTwoPressed(boolean value) {
this.buttonTwoPressed = value;
}
// Output parameters
private String message;
public String getMessage() {
return message;
}
}
WebWork文檔中的例子有問題(或許不適合ModelDriven模式)