只能有一个,服务器按着一个struts-config。xml文件,操作整个网站的流程
解决方案 »
- 北京JAVA技术交流乐园
- RCP版本的Eclipse和普通的Eclipse
- struts 中的org.apache.jasper.JasperException:错误
- java解析在头部没有指定编码的Xml结构的文件的问题.
- struts + ibatis 的初学者问题
- 哪个jms消息服务器适合这种结构
- 学了一段时间hibernate,突然觉得他很烂
- 请问如何开发代码生成的工具啊!
- 第三次问该问题,希望大家帮帮我
- Can not find the tag library descriptor for "/struts-tags"
- 关于TOMCAT的完全解释,,,如果高手解全部使用过程及方法,,另加分 UP 有分
- 请教有关j2sdkee
为了使用多应用模块功能,必须执行以下几个准备步骤:
• 为每个应用模块创建独立的Struts配置文件。
• 配置web 部署描述符 web.xml文件。
• 使用org.apache.struts.actions.SwitchAction 来实现程序在模块之间的跳转. <init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/bm</param-name>
<param-value>/WEB-INF/struts-config-bm.xml</param-value>
</init-param>
<init-param>
<param-name>config/ebank</param-name>
<param-value>/WEB-INF/struts-config-ebank.xml</param-value>
</init-param>当Struts载入应用程序时,它首先载入缺省应用模块的配置文件。然后查找带有字符串config/xxx 形式的附加的初始化参数。对每个附加的配置文件也进行解析并载入内存。这一步完成后,用户就可以很随意地用config/后面的字符串也就是名字来调用相应的应用模块。用两种方法可以从一个模块切换到另一个模块,一种是使用forward(global或local),并且
设置contextRelative属性为true,另一种是使用内建的org.apache.struts.actions.SwitchAction。使用global-forward设置模块切换: <global-forwards>
<forward name="toModuleB"
contextRelative="true"
path="/moduleB/index.do"
redirect="true"/>
</global-forwards>也可使用action的forward(local)设置,如 <action ... >
<forward name="success"
contextRelative="true"
path="/moduleB/index.do"
redirect="true"/>
</action>
SwitchAction实现模块切换
使用内建的org.apache.struts.actions.SwitchAction,例如: <action path="/toModule"
type="org.apache.struts.actions.SwitchAction"/>URL应包含prifix和page两个参数: http://localhost:8080/toModule.do?prefix=/moduleB&page=/index.do如要返回到默认模块,则: http://localhost:8080/toModule.do?prefix=&page=/index.do
如果你又进展,也告诉我一声,ok?
看着你的文挡确实无从下手,呵呵
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<init-param>
<param-name>mapping</param-name>
<param-value>org.apache.struts.action.ActionMapping</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/bm</param-name>
<param-value>/WEB-INF/struts-config-bm.xml</param-value>
</init-param>
<init-param>
<param-name>config/salexp</param-name>
<param-value>/WEB-INF/struts-config-salexp.xml</param-value>
</init-param>
<init-param>
<param-name>config/monitor</param-name>
<param-value>/WEB-INF/struts-config-monitor.xml</param-value>
</init-param>
<servlet>
• 配置web 部署描述符 web.xml文件。
• 使用org.apache.struts.actions.SwitchAction 来实现程序在模块之间的跳转. • 这是什么意思?另
<init-param>
<param-name>config/salexp</param-name>
<param-value>/WEB-INF/struts-config-salexp.xml</param-value>
</init-param>
就拿这做个比较,struts-config-salexp.xml这个配置文件说白了也是和struts-config.xml一样的功能,只不过名字改变,文件放置的文件夹都一样?这些还只是我想到的问题,等项目实施当中肯定还有很多问题,,以后还得请教 xujiaqiang了,,先谢了
xujiaqiang() 说得明白,我顶哦