例
<struts>
<package name="test" namespace="/test" extends = "struts-default">
<action name="helloword" class="com.helloword.helloword" method="exetuce">
<result name="success">/WEB-INF/page/hello.jsp</result>
</action>
</package>
</struts>
配置完成后,在src下新建一个class,
package为com.helloword即
,
NAME为helloword即
,完成。
编辑新建类(例)
package com.helloword;
public class helloword {
private String message;
public String getMessage() {
message="第一个Struts应用";
return message;
}
public String exetuce()
{
return "success";
}
}
完成后在浏览器输入http://localhost:8088/struts2/test/helloword,其中struts2为项目名称,test为package的命名空间,helloword为action的name。便成功显示第一个简单的struts应用。