Struts2初识
来源:互联网 发布:淘宝运动鞋 编辑:程序博客网 时间:2024/05/21 07:13
Struts2初识
第一次学习struts2,并进行小项目测试。
首先,新建一个web项目,导入关键jar包:
配置web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>hengsheng</display-name> <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>
新建struts2.xml,所有配置请见
创建一个action 类
/** * */package com.yz.action;/** * @author zhong * */public class LoginAction { private String userName; private String password; public String execute(){ System.out.println("=============execute============"); userName = "ADMIN_execute"; return "success"; } public String login(){ System.out.println("===========login=============="); userName = "ADMIN_login"; return "success"; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; }}
0 0
- struts2 初识
- 初识Struts2
- 初识struts2
- 初识struts2
- 初识Struts2
- Struts2初识
- 初识Struts2
- Struts2初识
- Struts2初识
- 初识Struts2
- 初识 Struts2
- 初识Struts2
- struts2初识
- (1)Struts2-初识Struts2
- Struts2 初识(一)
- Struts2 初识(二)
- Struts2初识(三) ---> interceptors
- Struts2之ValueStack(初识)
- VI编辑器(Visual Editor)之模式之间的转换方法
- Linux安装Oracle数据库配置大页内存
- python 网络编程学习 epoll多路复用
- PythonGui->对话框
- 51nod1126【矩阵快速幂】
- Struts2初识
- Nis服务器之Master-Slave设置
- 51node 1419 最小公倍数挑战
- go定时器收集,执行一次后每天24点执行程序
- 《纠结学习C++还是Java》之《如何学好Java》
- maven创建项目时在generating project in interactive mode卡住了
- JavaScript中eval()、with()和reduce()的用法
- 关于MediaPlayer
- Exif文件格式描述 Ver1.4