Struts 2.0的Action讲解
2007-11-11 13:05
399 查看
<% @ page contentType = " text/html; charset=UTF-8 " %>
<% @ taglib prefix = " s " uri = " /struts-tags " %>
< html >
< head >
< title > Hello World! </ title >
</ head >
< body >
< h2 >< s:property value ="message" /></ h2 >
</ body >
</ html >
例1 HelloWorld.jsp
package tutorial;
import java.text.DateFormat;
import java.util.Date;
import com.opensymphony.xwork2.ActionSupport;
public class HelloWorld extends ActionSupport {
private String message;
public String getMessage() {
return message;
}
@Override
public String execute() {
message = " Hello World, Now is " + DateFormat.getInstance().format( new Date());
return SUCCESS;
}
}
return有五个值
例1 classes/tutorial/HelloWorld.java
<package name="**"> 是URL 不是哪个包
< package name ="ActionDemo" extends ="struts-default" >
< action name ="HelloWorld" class ="tutorial.HelloWorld" >
< result > /HelloWorld.jsp </ result >
</ action >
</ package >
<% @ taglib prefix = " s " uri = " /struts-tags " %>
< html >
< head >
< title > Hello World! </ title >
</ head >
< body >
< h2 >< s:property value ="message" /></ h2 >
</ body >
</ html >
例1 HelloWorld.jsp
package tutorial;
import java.text.DateFormat;
import java.util.Date;
import com.opensymphony.xwork2.ActionSupport;
public class HelloWorld extends ActionSupport {
private String message;
public String getMessage() {
return message;
}
@Override
public String execute() {
message = " Hello World, Now is " + DateFormat.getInstance().format( new Date());
return SUCCESS;
}
}
return有五个值
例1 classes/tutorial/HelloWorld.java
<package name="**"> 是URL 不是哪个包
< package name ="ActionDemo" extends ="struts-default" >
< action name ="HelloWorld" class ="tutorial.HelloWorld" >
< result > /HelloWorld.jsp </ result >
</ action >
</ package >
相关文章推荐
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解(Struts 2.0系列之三)
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts 2.0的Action讲解
- Struts2.0 去掉action后缀名