lijiulong0512 2014-12-21 14:41 采纳率: 0%
浏览 1700

将jsp页面上的信息传递到action中

各位大神,求帮忙!!!
页面上的信息是这样:

    <table class="tabmenu" <c:if test="${fn:length(tabmap) < 2}">style="display:none"</c:if>>
        <tr>
            <c:forEach var="tab" items="${tabmap}" varStatus="vs">
                <td class="tabitem">
                    <a id="${vs.index}" onclick="return clickTab(${vs.index}, this.href);" href="<c:url value='/${tab.value}'/>" class="menulink" target="main"><fmt:message key="${tab.key}"/></a>
                </td>
                <c:choose>
                    <c:when test="${fn:length(tabmap)==vs.index+1}">
                        <td class="sep3" id="_${vs.index}"></td>
                    </c:when>
                    <c:otherwise>
                        <td class="sep2" id="_${vs.index}"></td>
                    </c:otherwise>
                </c:choose>
            </c:forEach>
        </tr>
    </table>

想要获取其中的 id="${vs.index}"的href,让action获取 并存在库表中。
页面的js如下:
function clickTab(tabId, href) {
try{
caCanvas.show();
var total = ${fn:length(tabmap)};
var selectedTab = document.getElementById(tabId).parentNode;
var selectedTab_ = document.getElementById("_" + tabId);
var selectedTab = document.getElementById("" + (tabId - 1));

            for(var i = 0; i < total; i++) {
                var tab = document.getElementById(i).parentNode;
                var tab_ = document.getElementById("_" + i);
                tab.className = "tabitem";
                if(total == i + 1) {
                    tab_.className = "sep3";
                } else {
                    tab_.className = "sep2";
                }   
            }

            selectedTab.className = "selected";

            if(total == parseInt(tabId) + 1) {      
                selectedTab_.className = "sep5";
            } else {
                selectedTab_.className = "sep1";
            }

            if(_selectedTab) {
                _selectedTab.className = "sep4";
            }


            if(href && href.indexOf('engineTab=1') != -1){
                if(typeof(eval(window.parent.frames["head"].window.displayEngineTab)) == "function"){
                    window.parent.frames["head"].window.displayEngineTab("");
                }
            }else{
                if(typeof(eval(window.parent.frames["head"].window.displayEngineTab)) == "function"){
                    window.parent.frames["head"].window.displayEngineTab("none");
                }
            }


            var expires = getExpDate(30, 0, 0);
            var id = "<c:out value='${id}' default='' />"
            addMainCookie(nameSpace + "tabmenu", id + "<"+tabId);

            dealEngineIcon(href);

            return true;
        }catch(e){}
    }

上面function中的href就是我所需要传递的值,我查看网上有说是用AJAX的还有使用隐藏域的还有使用session的 可是我都用了不好使,也许是我写错了 ,求各位大神看看能不能帮帮小弟,怎么写出来,思路是什么样的?谢谢谢谢谢

  • 写回答

3条回答 默认 最新

  • ooooooooooooooooooMG 2014-12-22 02:49
    关注

    click 事件需要Return的么?

    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序