struts2 helloworld
HelloWorld.jsp <%@ taglib prefix="s" uri="/struts-tags" %>
package tutorial; import com.opensymphony.xwork2.ActionSupport; public class HelloWorld extends ActionSupport {
public static final String MESSAGE = "Struts is up and running ...";
public String execute() throws Exception {
setMessage(MESSAGE);
return SUCCESS;
}
private String message;
public void setMessage(String message){
this.message = message;
}
public String getMessage() {
return message;
}
}
修改struts.xml文件: