主頁 > 知識庫 > jsp中一個頁面引入另一個頁面的實現(xiàn)代碼

jsp中一個頁面引入另一個頁面的實現(xiàn)代碼

熱門標(biāo)簽:北票市地圖標(biāo)注 四川保險智能外呼系統(tǒng)商家 商洛電銷 電銷機器人好賣么 杭州ai語音電銷機器人功能 杭州語音電銷機器人軟件 地圖標(biāo)注線上教程 高德地圖標(biāo)注樣式 電銷機器人是有一些什么技術(shù)

action代碼片段

復(fù)制代碼 代碼如下:

public String execute() {
        String ret = super.execute();

        if (RETURN_LIST.equals(ret)) {
            return list();
        } else {
            return ret;
        }
    }

    public String list() {
        String show = this.getRequest().getParameter("show");
        if ("show".equals(show)) {
            return show();
        }
        deptid = getRequest().getParameter("deptid");
        if (StringUtils.isNotBlank(deptid)) {
            epVO.getEp().setDeptid(Long.valueOf(deptid));
            epVO.setDeptid(deptid);
        }
        if (StringUtils.isNotBlank(deptname)) {
            epVO.getDept().setDeptname(deptname);
        }
        if (StringUtils.isNotBlank(plateno)) {
            epVO.setPlateno(plateno);
        }
        if (StringUtils.isBlank(deptid)) {
            epVO.getEp().setDeptid(Long.parseLong("1"));
        }

        int count = epService.getEpCount(epVO);
        PageInfor pageInfor = this.pageInit(this.getRequest(), count);
        epVO.setRownum_(pageInfor.getRownum_());
        epVO.setRownum(pageInfor.getRownum());
        epVO.setOrderName(pageInfor.getOrderName());
        ListEpVO> list = epService.getEps(epVO);
        this.getRequest().setAttribute(Constants.QUERY_DATA, list);
        this.getRequest().setAttribute(Constants.PAGE_INFO, pageInfor);

        ListObject> editors = new ArrayListObject>();
        editors.add(new EditorExt("text", "deptname", "公司"));
        editors.add(new EditorExt("text", "plateno", "車牌號"));
        editors.add(new EditorExt("text", "deptid", "ID"));
        this.getRequest().setAttribute("editor", editors);
        ListObject> header = new ArrayListObject>();
        ListObject> header = new ArrayListObject>();
        header.add(new Header("index", "序號", "index", "2%"));//1
        header.add(new Header("epVO.dept.deptname", "部門", null, "6%"));// 2 jQuery(function()中取普通的值 用下標(biāo)取 下標(biāo)是它出現(xiàn)的位置
        header.add(new Header("epVO.ep.name", "車牌號", null, "5%"));//3
        header.add(new Header("epVO.ep.epid", "內(nèi)部編號", null, "5%"));//4
        header.add(new Header("epVO.ep.eptype", "類型", null, "4%"));//5
        header.add(new Header("epVO.ep.devid", "設(shè)備號", null, "8%"));
        header.add(new Header("epVO.ep.devtype", "設(shè)備類型", null, "4%"));
        header.add(new Header("epVO.ep.phone", "電話", null, "5%"));
        header.add(new Header("epVO.ep.charge", "年服務(wù)費", null, "5%"));
        header.add(new Header("epVO.ep.info", "備注", null, "15%"));
        this.getRequest().setAttribute("header", header);
        this.getRequest().setAttribute("header", header);

        MapString, String> hidden = new LinkedHashMapString, String>();
        hidden.put("epVO.ep.id", "車輛ID");
        hidden.put("epVO.dept.deptid", "部門ID");//jQuery(function()中取隱藏域中的值
        hidden.put("epVO.ep.name", "車牌號");//jQuery(function()中取隱藏域中的值
        hidden.put("epVO.ep.eptype", "類型");
        this.getRequest().setAttribute("hidden", hidden);

        String flag = this.getRequest().getParameter("flag");
        this.getRequest().setAttribute("flag", flag);
        return RETURN_LIST;
}

jsp頁面引用代碼片段

復(fù)制代碼 代碼如下:

%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
%@ taglib uri="/struts-tags" prefix="s"%>
%@ taglib uri="/WEB-INF/web.tld" prefix="web"%>
!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
html>
head>
base target="_self">
meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
title>車輛信息/title>
web:jquery validate="true" formId="tableform" />
link type="text/css" rel="stylesheet" href="styles/css.css">
script src="scripts/DatePicker/WdatePicker.js">/script>
script src="scripts/Globals.js">/script>
script src="scripts/DhtmlTree/js/dhtmlxcommon.js">/script>
script src="scripts/DhtmlTree/js/dhtmlxtree.js">/script>
link type="text/css" rel="stylesheet"
    href="scripts/DhtmlTree/css/dhtmlxtree.css">
/head>

body>
    web:clean editorMeta="editor" />
    s:hidden name="epVO.deptid" id="deptid" />
    web:error />
    div id="query" class="framesytle">
       !-- 是否在了那個一個頁面中打開 -->
        s:if test="#attr.flag=='open'">
            web:queryTable action="listEp.action?flag=open" editorMeta="editor"
                title="查詢條件" />
            web:tableList action="listEp.action?method=listflag=open"
                headerMeta="header" hiddenMeta="hidden" title="查詢結(jié)果"
                showlist="hidden" top="false" mode="radio" />
        /s:if>
        s:else>
            web:queryTable action="listEp.action" editorMeta="editor"
                title="查詢條件" />
            web:tableList action="listEp.action?method=list" headerMeta="header"
                hiddenMeta="hidden" title="查詢結(jié)果" showlist="hidden" top="false"
                mode="radio" />
        /s:else>
    /div>
/body>
/html>
script language="JavaScript" type="text/JavaScript">   
    //部門查詢時用到的
    $("#queryBtn").removeAttr('onclick').click(
            function() {
                var obj = document.forms['queryForm'];
                obj.action = 's:url value="/listEp.action"/>'
                        + '?deptid=' + document.getElementById('deptid').value;
                obj.submit();
            });

    //打開時頁面要傳遞的值
    jQuery(function() {
        var flag = 's:property value="#attr.flag" />';
        if (flag == "open") {
            $("#dataTable tr").removeAttr("title").removeAttr("ondblclick");
            jQuery(".all_border .hs tbody tr").attr("title", "雙擊選中");
            jQuery(".all_border .hs tbody tr:gt(0)").removeAttr('ondblclick')
                    .dblclick(
                            function() {
                                //隱藏域中取的值 list()中取
                                var name = $(this).find("input[name='name']")
                                        .val();
                                //var deptname = $(this).find("input[name='deptname']").val();
                                var deptid = $(this).find(
                                        "input[name='deptid']").val();
                                //平常的值
                                var deptname = $(this).children().eq(2).text()
                                var info = $(this).children().eq(10).text()
                                        .split(";")[0];
                                if (info == "") {
                                    info = "暫無路線";
                                }
                                var arr = new Array();
                                arr[0] = name;
                                arr[1] = deptname;
                                arr[2] = deptid;
                                arr[3] = info;

                                returnValue = arr;
                                window.close();
                            });
        }
    });

    $(document)
            .ready(
                    function() {
                        var deptname = document.getElementById('deptname').value;
                        var deptid = document.getElementById('deptid').value;
                        var plateno = document.getElementById('plateno').value;

                        $("#queryTable")
                        .html("tbody>tr class='f1f1f1'>td align='right'>公司:/td>td class='r_border'>input type='text' value='"+deptname+"' id='deptname' name='deptname' class='input_sytle_1'>/td>td align='right'>車牌號:/td>td class='r_border'>input type='text' value='"+plateno+"' id='plateno' name='plateno' class='input_sytle_1'>input type='hidden' value='"+deptid+"' id='deptid' name='deptid' class='input_sytle_1'>/td>/tr>/tbody>");
                var tree = initDropDownTree('orgTree',
                        's:url value="/commonPage.action?method=getOrgTree"/>');
                setTextBoxTree('deptname', 'deptid', 'orgTree', tree);
                    });
/script>

jsp被引用js代碼片段

復(fù)制代碼 代碼如下:

script language="JavaScript" type="text/JavaScript">
   //另一個頁面
    // 這個頁面的id個數(shù) 是根據(jù)另一個頁面?zhèn)鬟^來的決定的
    function selPlateno(plateno,deptname,deptid,info)
    {   
        var ret = openWin("listEp.action?method=listflag=open", "900px", "500px");
        if (ret != undefined) {
            document.getElementById(plateno).value=ret[0];
            document.getElementById(deptname).value=ret[1];
            document.getElementById(deptid).value=ret[2];
            document.getElementById(info).value=ret[3];

        }
    }

    //加載圖片顯示另一個頁面
    $(document).ready(function(){
        //
        $("#plateno").after("nbsp;img onclick=\"selPlateno('plateno','deptname','deptid','info')\" style=\"cursor:hand; vertical-align:text-bottom\" src=\"s:url value='/images/sel.jpg'/>\" alt=\"選擇\" border=\"0\">");
    });   
/script>

您可能感興趣的文章:
  • jsp頁面中引用其他頁面的簡單方法

標(biāo)簽:紅河 云浮 宿州 江西 丹東 貴州 西藏 青島

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《jsp中一個頁面引入另一個頁面的實現(xiàn)代碼》,本文關(guān)鍵詞  jsp,中,一個,頁面,引入,另一個,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《jsp中一個頁面引入另一個頁面的實現(xiàn)代碼》相關(guān)的同類信息!
  • 本頁收集關(guān)于jsp中一個頁面引入另一個頁面的實現(xiàn)代碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章