一个Struts 框架中只能有一个struts-config.xml配置文件吧?
解决方案 »
- struts2 基于注解配置问题
- [设计问题]复合查询如何实现
- 求hibernate分页方法封装
- java 程序 怎样导入导出informix的表数据
- 关于struts2中getSession()为空的问题,求助。。
- apache-cxf-2.1.3自带例子callback的basic_callback.wsdl在myeclipse 6.5工具中报错,请问如何解决?
- webservice得不到变量值问题
- 程序中如何实现用工具下载
- hibernate2中的批量插入问题
- 从网上下载一个关于oracle的jdbc驱动,不知怎么安装,急用????????????????谢谢了
- 哪位有空讲一下ejb,远程接口,home接口,企业bean,这间是怎么调用的?
- 我有电子版[PDF]的tomcat配置手册,哪位要
///
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>app</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/test</param-name>
*** <param-value>/WEB-INF/struts-config-test.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>1</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>2. prepare struts-config.xml file
///add module name before forward's path attribute.
<struts-config>
...
<global-forwards>
<forward name="toModuleB"
contextRelative="true"
path="/moduleB/index.do"
redirect="true"/>
...
</global-forwards>
...
</struts-config>
///
<action-mappings>
<!-- Action mapping for profile form -->
<action path="/login"
type="com.ncu.test.LoginAction"
name="loginForm"
scope="request"
input="tile.userLogin"
validate="true">
*** <forward name="success" contextRelative="true" path="/moduleA/login.do"/>
</action>
</action-mappings>
//if you want to return to default configuration,
forward name="success" contextRelative="true" path="/login.do"/>
//otherwise, you can use SwitchAction
//A standard Action that switches to a new module and then
forwards control to a URI (specified in a number of possible ways) within the new module.
...
<action-mappings>
<action path="/toModule"
type="org.apache.struts.actions.SwitchAction"/>
...
</action-mappings>
...
3. You can validate html form data in server-side with dynavalidatorform or actionform's execute method.
But you can choose Client-side check in your jsp pages, if browser does't support, it will use Server-side
validator.
How to set up?
////
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<table bgcolor="#9AFF9A" cellspacing="0" cellpadding="10" border="1" width="100%">
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr bgcolor="#696969">
<td align="center">
<font color="#FFFFFF">Panel 3: Profile</font>
</td>
</tr>
<tr>
<td><br>
<html:errors/>
***** <html:form action="/login.do" focus="username" onsubmit="return validateLoginForm(this);">
<html:hidden property="actionClass"/>
<center>
<table>
<tr>
<td>UserName:</td>
<td><html:text property="username" size="20"/></td>
</tr>
<tr>
<td>Password:</td>
<td><html:password property="password" size="20"/></td>
</tr>
<tr>
<td colspan=2><html:submit property="submitProperty" value="Submit"/></td>
</table>
</center>
</html:form>
***** <html:javascript formName="loginForm" dynamicJavascript="true" staticJavascript="false"/>
***** <script language="Javascript1.1" src="staticJavascript.jsp"></script>
</td>
</tr>
</table>
</td>
</tr>
</table>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml,
/WEB-INF/struts-config-MODELA.xml,
</param-value>
</init-param>
....
<nested:form action="/Login.do" method="post">
...
</nested:form>
不用殖民是什么模块!
不过我也刚开始用,比较糊涂...这是在菜单里调用..再在里面的jsp里调用的话,就可以直接action="action.do"了..
我感觉好像 "模块/action.do"转向的jsp里再调用就不用指明 模块了,可以直接 acitong="action.do" ..
这只是我的感觉,,具体怎样有待有经验者赐教...
得到request.getAttribute("javax.servlet.include.servlet_path")
如果为null使用request的path.
从上面的得到module的prefix
,
然后寻找module.再servletContext中寻找
Globals.MODULE_KEY+prefix
得到module的。可以这样认为
比如说请求路径是
http:www.fdf.com.cn/webContext/module/XXX.do
那么没有在request指定javax.servlet.include.servlet_path的话
请求的module就是名字为module的module.
不过我也刚开始用,比较糊涂...这是在菜单里调用..再在里面的jsp里调用的话,//里面是什么意思?输入的时候?再被其它调用的时候?
就可以直接action="action.do"了..
我感觉好像 "模块/action.do"转向的jsp里再调用就不用指明 模块了,//??
可以直接 acitong="action.do" ..我也刚开始用没多长时间~~~和2星的牛人讨论学习一下~:)