我是靠谱客的博主 安详往事,这篇文章主要介绍struts1跳入指定方法,现在分享给大家,希望可以做个参考。

1 主页面调用

复制代码
1
2
3
4
$.ajax({ <a target=_blank href="'<%=contextPath%>/cap/mainPage/updateTreeInfo.do?method=updateTree">url:"<%=contextPath%>/cap/mainPage/updateTreeInfo.do?method=updateTree</a>",
复制代码
1
2
3
data:{inputValue:info},
复制代码
1
2
dataType:"json",
复制代码
1
2
success:function(result){
复制代码
1
2
3
4
alert("success"); } });


2 java 类

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.hm.web.mainPage.action; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.actions.DispatchAction; public class UpdateMainPageTree extends DispatchAction{ /* * 更新主页面树信息 * */ public void updateTree(ActionMapping mapping,ActionForm form,HttpServletRequest request, HttpServletResponse response){ String inputValue = request.getParameter("inputValue"); try { inputValue = URLDecoder.decode(inputValue, "UTF-8"); System.out.println("inputValue3 = " + inputValue); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } }


3 spring配置文件

复制代码
1
2
<!-- 更新主页面树信息 --> <bean name="/cap/mainPage/updateTreeInfo" class="com.hm.web.mainPage.action.UpdateMainPageTree" autowire="byType" />


 

4 struts1 文件配置

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?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> <!-- 上传excel的formBean --> <form-bean name="uploadform" type="com.hm.web.excel.upload.entity.ExcelUploadForm"></form-bean> </form-beans> <action-mappings> <!-- 更新主页面树信息配置开始 --> <action path="/cap/mainPage/updateTreeInfo" type="org.springframework.web.struts.DelegatingActionProxy" scope="request" validate="false" parameter="method" > <forward name="result" path="/Module/cap/device/CapDeviceIndex.jsp"></forward> </action> <!-- 更新主页面树信息配置结束 --> </action-mappings> </struts-config>


 

 

最后

以上就是安详往事最近收集整理的关于struts1跳入指定方法的全部内容,更多相关struts1跳入指定方法内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(78)

评论列表共有 0 条评论

立即
投稿
返回
顶部