佳木斯湛栽影视文化发展公司

主頁(yè) > 知識(shí)庫(kù) > jsp中一個(gè)頁(yè)面引入另一個(gè)頁(yè)面的實(shí)現(xiàn)代碼

jsp中一個(gè)頁(yè)面引入另一個(gè)頁(yè)面的實(shí)現(xiàn)代碼

熱門(mén)標(biāo)簽:科大訊飛語(yǔ)音識(shí)別系統(tǒng) 電子圍欄 阿里云 銀行業(yè)務(wù) Mysql連接數(shù)設(shè)置 Linux服務(wù)器 團(tuán)購(gòu)網(wǎng)站 服務(wù)器配置

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", "車(chē)牌號(hào)"));
        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", "序號(hào)", "index", "2%"));//1
        header.add(new Header("epVO.dept.deptname", "部門(mén)", null, "6%"));// 2 jQuery(function()中取普通的值 用下標(biāo)取 下標(biāo)是它出現(xiàn)的位置
        header.add(new Header("epVO.ep.name", "車(chē)牌號(hào)", null, "5%"));//3
        header.add(new Header("epVO.ep.epid", "內(nèi)部編號(hào)", null, "5%"));//4
        header.add(new Header("epVO.ep.eptype", "類(lèi)型", null, "4%"));//5
        header.add(new Header("epVO.ep.devid", "設(shè)備號(hào)", null, "8%"));
        header.add(new Header("epVO.ep.devtype", "設(shè)備類(lèi)型", null, "4%"));
        header.add(new Header("epVO.ep.phone", "電話(huà)", null, "5%"));
        header.add(new Header("epVO.ep.charge", "年服務(wù)費(fèi)", 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", "車(chē)輛ID");
        hidden.put("epVO.dept.deptid", "部門(mén)ID");//jQuery(function()中取隱藏域中的值
        hidden.put("epVO.ep.name", "車(chē)牌號(hào)");//jQuery(function()中取隱藏域中的值
        hidden.put("epVO.ep.eptype", "類(lèi)型");
        this.getRequest().setAttribute("hidden", hidden);

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

jsp頁(yè)面引用代碼片段

復(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>車(chē)輛信息/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">
       !-- 是否在了那個(gè)一個(gè)頁(yè)面中打開(kāi) -->
        s:if test="#attr.flag=='open'">
            web:queryTable action="listEp.action?flag=open" editorMeta="editor"
                title="查詢(xún)條件" />
            web:tableList action="listEp.action?method=listflag=open"
                headerMeta="header" hiddenMeta="hidden" title="查詢(xún)結(jié)果"
                showlist="hidden" top="false" mode="radio" />
        /s:if>
        s:else>
            web:queryTable action="listEp.action" editorMeta="editor"
                title="查詢(xún)條件" />
            web:tableList action="listEp.action?method=list" headerMeta="header"
                hiddenMeta="hidden" title="查詢(xún)結(jié)果" showlist="hidden" top="false"
                mode="radio" />
        /s:else>
    /div>
/body>
/html>
script language="JavaScript" type="text/JavaScript">   
    //部門(mén)查詢(xún)時(shí)用到的
    $("#queryBtn").removeAttr('onclick').click(
            function() {
                var obj = document.forms['queryForm'];
                obj.action = 's:url value="/listEp.action"/>'
                        + '?deptid=' + document.getElementById('deptid').value;
                obj.submit();
            });

    //打開(kāi)時(shí)頁(yè)面要傳遞的值
    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 = "暫無(wú)路線(xiàn)";
                                }
                                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'>車(chē)牌號(hào):/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">
   //另一個(gè)頁(yè)面
    // 這個(gè)頁(yè)面的id個(gè)數(shù) 是根據(jù)另一個(gè)頁(yè)面?zhèn)鬟^(guò)來(lái)的決定的
    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];

        }
    }

    //加載圖片顯示另一個(gè)頁(yè)面
    $(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頁(yè)面中引用其他頁(yè)面的簡(jiǎn)單方法

標(biāo)簽:江蘇 大理 衡水 廣元 蚌埠 棗莊 衢州 萍鄉(xiāng)

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《jsp中一個(gè)頁(yè)面引入另一個(gè)頁(yè)面的實(shí)現(xiàn)代碼》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話(huà)咨詢(xún)

    • 400-1100-266
    巴马| 莲花县| 万载县| 新竹市| 建水县| 阿拉善左旗| 精河县| 高清| 阜南县| 息烽县| 大埔县| 托里县| 宁都县| 阳东县| 通河县| 黄山市| 新昌县| 莆田市| 泌阳县| 化州市| 确山县| 沾益县| 玛曲县| 密云县| 察哈| 福泉市| 红原县| 定陶县| 东乡县| 松原市| 左云县| 栾城县| 凤凰县| 西青区| 赤壁市| 崇礼县| 定襄县| 乌拉特前旗| 甘孜县| 都江堰市| 九寨沟县|