struts2配置
来源:互联网 发布:网络电视直播在线 编辑:程序博客网 时间:2024/06/11 10:01
第一步:获取struts
第二步:新建动态web项目
第三步:导入必要包
如下:
第三步:配置web.xml
<?xml version= "1.0" encoding ="UTF-8"?> <web-app id= "WebApp_9" version ="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <welcome-file-list > <welcome-file> index.jsp</welcome-file > <welcome-file> index.html</welcome-file > </welcome-file-list > <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 > <!-- ... --> </web-app>
第四步:创建struts.xml(src下面)并配置
<?xml version= "1.0" encoding ="UTF-8" ?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <!-- 声明包 --> <constant name="struts.enable.DynamicMethodInvocation" value="true" /> <package name="myPackage" extends= "struts-default" namespace="/" > <!-- 定义action --> <action name="first" > <!-- 定义处理成功后的返回界面 --> <result> first.jsp</result > </action > </package ></struts>
第五步:测试。在index.jsp中加入一个连接,调用action
<body> < a href ="first.action">通过struts框架 </a></body>创建first.jsp<body> <h1> 这是通过struts框架过来的 </h1></body>
- struts2配置
- struts2配置
- Struts2配置
- Struts2配置
- struts2 配置
- Struts2配置
- Struts2配置
- Struts2 配置
- struts2 配置
- struts2配置
- struts2配置
- struts2配置
- struts2配置
- struts2配置
- struts2配置
- struts2配置
- struts2配置
- struts2配置
- mdadm简介
- slider控件移动滑块,动态的显示tooltip方法!
- VC常用方法(转载)
- 制作U盘启动CDLinux
- 奶瓶beini系统
- struts2配置
- 打造3D游戏中第一人称视觉效果 - 带可测试源代码下载
- 关于对象
- 将指定窗口设为顶层窗口SetForegroundWindow的正确用法
- 怎样使用回调函数?
- OpenJDK源码研究笔记(十):枚举的高级用法,枚举实现接口,竟是别有洞天
- android游戏开发——微信打飞机(一)
- 说说WordPress的主查询函数-query_posts()
- Mac下搭建svn服务器教程(终端与 Xcode的使用)