ssh之struts2xml简单配置
来源:互联网 发布:台风战斗机 知乎 编辑:程序博客网 时间:2024/05/19 07:09
ssh之struts2xml简单配置
1.毋容置疑,导进jar包:
2.在网站入口web.xml配置struts2的中央过滤器:
<?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>ssh_xml_demo01</display-name>
<!-- 配置struts2中央过滤器 -->
<filter>
<filter-name>strutsFilter</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>strutsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
3.写Action类:package com.ltz.action;
public class UserAction {
public String login(){
System.out.println("login...");
return null;
}
}
4.配置struts.xml文件:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "struts-2.3.dtd" >
<struts>
<package name="default" extends="struts-default">
<action name="userAction" class="com.ltz.action.UserAction" method="login"></action>
</package>
</struts>
5.写JSP文件:<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<a href="${pageContext.request.contextPath}/userAction.action">测试</a>
</body>
</html>
经过以上几步就可以将struts简单配置出来了。但是,这只是皮毛而已,想了解更多关于struts的知识,还需要更深入的学习。
0 0
- ssh之struts2xml简单配置
- ssh之spring的xml简单配置
- ssh简单配置
- ssh的简单配置
- Struts2XML验证
- fedora之ssh配置
- fedora之ssh配置
- SSH(ArchLinux) 的简单配置
- Git 配置SSH简单玩法?
- SSH配置之web.xml
- SSH配置之web.xml .
- SSH配置之web.xml .
- SSH配置之web.xml
- SSH之hibernat配置文件配置
- SSH之Tomcat环境配置
- SSH配置之web.xml
- SSH框架之VO配置
- ssh整合之环境配置
- Xml特点,语法规范
- Levenshtein distance最小编辑距离算法实现
- S2SH+ajax+json-------(二)实现异步加载
- AndroidStudio实用插件收集
- 我自己对三维数组的理解
- ssh之struts2xml简单配置
- 拓扑排序模板
- POJ Power Network (dinic)
- SkipList 跳表
- C语言学习-通过柴田望洋的《明解C语言》(3)
- 优秀程序员的七大特征,你具备几条?
- Logistic回归总结
- freqspace
- HDU 2088 &&TOJ 1601. Box of Bricks【水题】好思路