<?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"> <!-- 其他拦截器 --> <!-- 引入struts核心过滤器 --> <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> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>
package cn.itcast.a_config;
import com.opensymphony.xwork2.ActionSupport;
public class UserAction extends ActionSupport {
// Action中业务处理方法
public String login() {
System.out.println("UserAction.login()");
return "success";
}
}
package cn.itcast.a_config;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
public class UserAction implements Action {
// Action中业务处理方法
public String login() {
System.out.println("UserAction.login()");
return "success";
}
@Override
public String execute() throws Exception {
return null;
}
}
package cn.itcast.a_config;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
public class UserAction {
private String userName;
public void setUserName(String userName) {
this.userName = userName;
}
// Action中业务处理方法
public String login() {
System.out.println("UserAction.login()" + userName);
return "login";
}
public String register() {
System.out.println("register()" + userName);
return "register";
}
}
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <package name="config" namespace="/" extends="struts-default"> <action name="login" class="cn.a_config.UserAction" method="login"> <result name="success">/index.jsp</result> </action> </package> </struts>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有