ubuntu服务器 运行struts框架
1、新建javaweb工程,新建web.xml。servlet指定访问路径, filter指定过滤器路径。 本例fileter拦截所有请求。 <web-app> <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> <dispatcher>FORWARD</dispatcher> <dispatcher>REQUEST</dispatcher> <url-pattern>/*</url-pattern> </filter-mapping></web-app>

2、配置struts.xml文件。访问index路径时候,跳转到index.jsp。 <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts> <package name="basicstruts" extends="struts-default"> <action name="index"> <result>index.jsp</result> </action> </package></struts>

3、添加index.jsp.Hello Struts2 World

4、1导入需要的包。链接:http://pan.baidu.com/s/1bptXiZ9 密码:l8ze4.2上传到ubuntu服务器,服务器显示struts框架发送的内容。

