web.xml
http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
Struts Blank
struts2
org.apache.struts2.dispatcher.FilterDispatcher
struts2
/*
index.jsp
Hello.java
package zb.struts2.test;
import com.opensymphony.xwork2.ActionSupport;
public class Hello extends ActionSupport{
private String name;
private String email;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String execute()
{
name="hello, "+name+" !";
email="your email is: "+email+" !";
return SUCCESS;
}
}
Hello.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
测试struts2
HelloResult.jsp
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
测试Hello的结果
本文作者:佚名 来源::http://www.gold98.net/blog
CIO之家 www.ciozj.com 微信公众号:imciow