67,513
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="UTF-8" ?>
<!--
/*
* $Id: struts-plugin.xml 722219 2008-12-01 20:41:26Z musachy $
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-->
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.action.extension" value="action,do" />
<!-- 声明包 -->
<package name="myPackage" extends="struts-default">
<!-- 定义action -->
<action name="userAction" class="com.action.UserAction">
<!-- 添加成功的映射页面 -->
<result name="add">user_add.jsp</result>
<!-- 更新成功的映射页面 -->
<result name="update">user_update.jsp</result>
</action>
</package>
<!-- 声明包 -->
<package name="myPackage2" extends="struts-default">
<!-- 定义action -->
<action name="TestAction" class="com.action.TestAction">
<!-- 处理成功的映射页面 -->
<result>success.jsp</result>
</action>
</package>
</struts>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<!-- END SNIPPET: filter -->
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
package com.action;
import com.opensymphony.xwork2.ActionSupport;
/**
* Map类型的request、session、application
*/
public class TestAction extends ActionSupport {
private static final long serialVersionUID = 1L;
public TestAction(){
}
/**
* 请求处理方法
* @return String
*/
public String execute() throws Exception{
return SUCCESS;
}
}
<action name="addmlm" class="hb.action.MlmAction" method="addMlm" />
<action name="runmlm" class="hb.action.MlmAction" method="runMlm" />
<action name="updatemlm" class="hb.action.MlmAction" method="updateMlm" />
<action name="compilemlm" class="hb.action.MlmAction" method="compileMlm" />
<action name="requestast" class="hb.action.MlmAction" method="requestAST" />
<action name="requestmlm" class="hb.action.MlmAction" method="requestMlm" />
<action name="requestmlms" class="hb.action.MlmAction" method="requestMlms" />
<package name="myPackage" extends="struts-default" namespace="/">
<!-- 定义action -->
<action name="userAction_*" method="{1}" class="com.action.UserAction">
<!-- 添加成功的映射页面 这个路径要用绝对的,绝对与应用webroot的路径,相对的是相对于当前的servlet路径-->
<result name="add">/user_add.jsp</result>
<!-- 更新成功的映射页面 -->
<result name="update">/user_update.jsp</result>
</action>
</package>