2015年9月10日 struts2TEST
2015-09-10 10:44
483 查看
action包下SuiBianAction.java
struts.xml
index.xml
ok.xml
web.xml
package action; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionSupport; public class SuiBianAction extends ActionSupport { public String execute() throws Exception{ System.out.println("execute called。"); return "success"; } }
struts.xml
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <package name="default" extends="struts-default" namespace="/"> <action name ="suibian" class ="action.SuiBianAction"> <result> ok.jsp</result> </action> </package> </struts>
index.xml
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <a href ="suibian">to web.xml struts.xml action的名字</a> </body> </html>
ok.xml
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> ok. <br> </body> </html>
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping></web-app>
相关文章推荐
- Java:对象的强、软、弱和虚引用
- Spring mvc视图解析器
- eclipse设置maven加载国内镜像
- Java变量参数
- How to setup Eclipse with WinAVR and the Eclipse plugin AVR-eclipse
- 配置Eclipse自动编译NDK/JNI
- JAVA基础学习(七)---面向对象三---继承,接口与 抽象类
- java多态性实例
- Java自定义标签库的开发及其工作流程的解读
- 浅谈spring中BeanDefinitionDocumentReader中的作用
- java实现Fibonacci算法实例
- Jenkins+maven+checkstyle对java代码进行静态代码分析
- Dubbo与Zookeeper、SpringMVC整合和使用(负载均衡、容错)
- JAVA运行时问题诊断-工具应用篇
- Eclipse下使用JUnit Test
- Java中key可以重复的Map集合:IdentityHashMap
- Java类的初始化顺序 (静态变量、静态初始化块、变量、初始...
- Eclipse helios 上编写arduino程序并进行烧录
- Java中泛型是类型擦除的
- 在eclipse中启动服务器报ERROR:transport error 202 ...ERROR: JDWP Transport dt_socket failed to initialize...