日期:2014-05-17 浏览次数:20734 次
<package name="itcast2" namespace="" extends="struts-default"> <action name="helloworld" class="com.wjf.HelloWorldActio" method="execute"> <param name="message">hello world</param> <result name="success">/myFirstStruts2.jsp</result> </action> </package>
action: public class HelloWorldActio { private String message; public String getMessage(){ System.out.println("调用了get方法"); return this.message; } public void setMessage(String msg){ System.out.println("调用了set方法"); this.message = msg; } public String execute(){ return "success"; } }
jsp: <body> 1、<s:property value="message"/> </body>