zoukankan      html  css  js  c++  java
  • JSP页面传值

    功能:

      页面A1传一个值:zsdwh,到B页面,再到C页面;然后C页面再把值传回B页面,B页面返回A1页面。

      页面A2传一个值:ywzx,   到B页面,再到C页面;然后C页面再把值传回B页面,B页面返回A2页面。

    (这里只举例A1——>B——C;C——>B——>A1)

    步骤:

    一、A1页面,把值:zsdwh赋值给requestType

    二、根据struts配置文件,找到后台action中的 shiftNetFlowInfo 方法,

    三、在方法 shiftNetFlowInfo 中添加代码:

      String requestType = request.getParameter("requestType");//接受前台页面传过来的requestType的值:zsdwh

      request.setAttribute("requestType", requestType);//把值带回此方法执行之后的前台页面(在这里暂时命名为B页面)

    四、根据刚刚的struts配置文件,找到上一个方法执行完之后跳转的页面:shiftNetFlowInfo.jsp

    五、在B页面(shiftNetFlowInfo.jsp)中添加如下代码:

    六、根据struts配置文件,找到后台action中的 snfHistory 方法

    七、在方法 snfHistory 中添加代码:

      String requestType = request.getParameter("requestType");//接受前台页面传过来的requestType的值:zsdwh

      request.setAttribute("requestType", requestType);//把值带回此方法执行之后的前台页面(在这里暂时命名为C页面)

    八、根据刚刚的struts配置文件,找到上一个方法执行完之后跳转的页面:snfHistoryInfo.jsp

    九、在C页面(snfHistoryInfo.jsp)中添加如下代码(太长截不了图,就直接粘贴代码了):

    <c:if test="${requestType=='zsdwh' }">
            <input type="button" name="button" id="button" value="返  回" class="submit" onclick="window.location.href='<skc:go name="shiftNetFlow_shiftNetFlowInfo" defaultUri="shiftNetFlow.do?requestType=zsdwh"></skc:go>'"/>
    </c:if>

    注释:

      第二行代码最后的requestType=zsdwh,是为了把值带回后台action方法:shiftNetFlowInfo

      根据struts配置文件:

      

      把值带回给页面B(shiftNetFlowInfo.jsp)

    十、在B页面,添加判断方法,如果值等于zsdwh,点击返回按钮,根据struts配置文件,会执行方法:getShiftNetFlowSheetToEdit

    <c:if test="${requestType=='zsdwh' }">
           <input type="button" name="button" id="button" value="返回" class="submit" onclick="window.location.href='<skc:go name="shiftNetFlow_getShiftNetFlowSheetToEdit" defaultUri="getShiftNetFlowSheetToEdit.do"</skc:go>'"/>
    </c:if>

    PS:解决了,两个页面(页面A1,页面A2),调用同一个方法跳转到同一个页面(页面B),点击返回按钮时,可以分别跳转回原来的页面。

  • 相关阅读:
    〖教程〗Ladon提权MS16-135参数版(WIN7-2016)
    〖教程〗RDP会话劫持 Ladon无密码登陆管理员桌面会话
    Ladon for PowerShell远程加载教程
    〖教程〗NbtScan 139端口弱口令/Netbios密码爆破
    给你一个免费加入"小密圈"的机会
    活动目录(Active Directory,AD)的主要功能
    如何通过审计安全事件日志检测密码喷洒(Password Spraying)攻击
    mouseenter 和mouseover的区别
    如何获取可视区域宽高,获取元素到在文档中的位置
    闭包
  • 原文地址:https://www.cnblogs.com/Lemon-ZYJ/p/8602377.html
Copyright © 2011-2022 走看看