struts模块配制
来源:互联网 发布:重庆万州网络花店 编辑:程序博客网 时间:2024/05/16 09:44
Struts多模块应用的配置
--------------------------------------------------------------------------------
建立一个简单的多模块应用"Moduler"
PHP 代码:
Moduler
-index.jsp
-module1
-index.jsp
-module2
-index.jsp
-WEB-INF
-struts-*.tld
-struts-config.xml
-web.xml
-lib
-*.jar
-module1
-struts-config.xml
-module2
-struts-config.xml
-classes
-your_package
web-inf下面的struts-config.xml是struts应用默认配置
对子模块的配置文件可以放在任意的位置,为了让Tomcat能够找到它们的位置,你需要在web.xml中配置
<!-- module configurations -->
<init-param>
<param-name>config/module1</param-name>
<param-value>/WEB-INF/module1/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/module2</param-name>
<param-value>/WEB-INF/module2/struts-config.xml</param-value>
</init-param>
在应用的根目录下面分别建立子模块的目录:<WebRoot>/module1 <WebRoot>/module2。里面放置子模块自己的jsp,html和图片等资源。
这里需要注意,在配置web.xml时指定的"config/module1"就已经隐含的指定子模块的名字分别是module1,module2
所以,子模块的目录叫起名叫"module1"和"module2"
三个模块的struts配置:
默认模块(WEB-INF/struts-config.xml)
<action-mappings>
<action path="/welcome" forward="/index.jsp"></action>
</action-mappings>
子模块1(WEB-INF/module1/struts-config.xml)
<action-mappings>
<action path="/welcome" forward="/index.jsp"></action>
</action-mappings>
子模块2(WEB-INF/module2/struts-config.xml)
<action-mappings>
<action path="/welcome" forward="/index.jsp"></action>
</action-mappings>
三个模块之间的跳转:
默认模块(index.jsp)
<html:link module="/module1" action="/welcome">转到子模块1的主页面</html:link>
<html:link module="/module2" action="/welcome">转到子模块2的主页面</html:link>
子模块1(module1/index.jsp)
<html:link action="../welcome">转到主页面</html:link>
<html:link module="/module2" action="/welcome">转到子模块2的主页面</html:link>
子模块2(module2/index.jsp)
<html:link action="../welcome">转到主页面</html:link>
<html:link module="/module1" action="/welcome">转到子模块1的主页面</html:link>
模块之间的跳转还可以通过配置struts-config.xml中的<forward>元素,具体方法可以参照struts-documentation的说明。
在web.xml的servlet节点下,<load-on-startup>节点前添加:
<!-- 模块级配置 -->
<init-param>
<param-name>config/admin</param-name>
<param-value>/WEB-INF/config/struts-config-admin.xml</param-value>
</init-param>
在WEB-INF下添加config文件夹以及其中的struts-config-admin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans>
</form-beans>
<action-mappings>
<!-- 产品管理配置 -->
<action path="/productservice"
type="com.newer.struts.action.productmanager.ProductManagerAction"
scope="request"
validate="false"
parameter="action">
<forward name="save" path="/productCreate.jsp"></forward>
</action>
</action-mappings>
</struts-config>
- struts模块配制
- struts中多模块如果配制
- struts中多模块如果配制
- Struts入门配制
- struts-hibernate-spring基础配制
- struts-config.xml 配制连接 access
- Struts国际化中资源文件的配制
- jsp,struts从头开始:之数据库连接池配制(MYSQL)
- Struts多模块开发
- struts多模块开发
- struts多模块开发
- struts 多模块配置
- struts多模块开发
- struts 多模块配置
- struts多模块开发
- Struts 多模块
- struts多模块开发
- Struts 多模块应用
- 蓝牙芯片1.1和1.2以及2.0各个规格之间的区别(手机开发)
- 第十三章JDBC基础知识
- 关于手机上WIFI功能的详细介绍(手机开发)
- session 和 sessionfactory 两大类的处理方式
- -
- struts模块配制
- java程序的打包与发布
- 判断用户是否登陆.BaseAction
- 函数定义
- glibc
- 20个免费的网络电话收集分享
- 来自Python初学者的三大困难
- matlab图像处理函数汇总
- Google Chrome究竟伤害了谁?