如果在struts.xml文件中<action>沒有method屬性,例如:<action name="helloWorld" class="action.HelloWorld">,那麼在HelloWorld.java中默認必須具有public String execute()方法;
如果具有method屬性,可以不用寫execute()方法,例如:<action name="helloWorld" class="action.HelloWorld" method="hello">,那麼在HelloWorld.java中具有public String hello()方法就可以了;
也可以在HelloWorld.java中寫多個方法,然後在action中根據name的不同,選用不同的method。