JSP in a page to introduce another page implementation code _JSP programming

Source: Internet
Author: User

Action Code Fragment

Copy Code code as follows:

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 to 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 ());
list<epvo> list = Epservice.geteps (EPVO);
This.getrequest (). setattribute (Constants.query_data, list);
This.getrequest (). setattribute (Constants.page_info, pageinfor);

list<object> editors = new arraylist<object> ();
Editors.add (New Editorext ("text", "Deptname", "Company"));
Editors.add (New Editorext ("text", "Plateno", "license plate number"));
Editors.add (New Editorext ("text", "DeptID", "ID"));
This.getrequest (). setattribute ("editor", editors);
List<object> Header = new arraylist<object> ();
List<object> Header = new arraylist<object> ();
Header.add (New Header ("index", "ordinal", "index", "2%"));//1
Header.add (New Header ("EpVO.dept.deptname", "department", NULL, "6%"))//2 jQuery (function () takes a normal value with subscript to remove the mark is where it appears
Header.add (New Header ("EpVO.ep.name", "License plate number", NULL, "5%"));//3
Header.add (New Header ("EpVO.ep.epid", "internal number", NULL, "5%"));//4
Header.add (New Header ("EpVO.ep.eptype", "type", NULL, "4%"));//5
Header.add (New Header ("EpVO.ep.devid", "device number", NULL, "8%"));
Header.add (New Header ("EpVO.ep.devtype", "Device type", NULL, "4%"));
Header.add (New Header ("EpVO.ep.phone", "telephone", NULL, "5%"));
Header.add (New Header ("EpVO.ep.charge", "Annual service charge", NULL, "5%"));
Header.add (New Header ("EpVO.ep.info", "remark", NULL, "15%"));
This.getrequest (). setattribute ("header", header);
This.getrequest (). setattribute ("header", header);

Map<string, string> hidden = new linkedhashmap<string, string> ();
Hidden.put ("EpVO.ep.id", "Vehicle id");
Hidden.put ("EpVO.dept.deptid", "Department id");//jquery (function () to take values from hidden fields
Hidden.put ("EpVO.ep.name", "license plate number");//jquery (function () to take values from hidden fields
Hidden.put ("EpVO.ep.eptype", "type");
This.getrequest (). setattribute ("hidden", hidden);

String flag = This.getrequest (). GetParameter ("flag");
This.getrequest (). setattribute ("flag", flag);
return return_list;
}

JSP page reference Code fragment

Copy Code code as follows:

<%@ 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" >
<base target= "_self" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title> Vehicle Information </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" >

<body>
<web:clean editormeta= "Editor"/>
<s:hidden name= "Epvo.deptid" id= "DeptID"/>
<web:error/>
<div id= "Query" class= "Framesytle" >
<!--open--> on that page
<s:if test= "#attr. flag== ' Open '" >
<web:querytable action= "Listep.action?flag=open" editormeta= "editor"
title= "Query Criteria"/>
<web:tablelist action= "Listep.action?method=list&flag=open"
Headermeta= "header" Hiddenmeta= "hidden" title= "Query Results"
showlist= "hidden" top= "false" mode= "Radio"/>
</s:if>
<s:else>
<web:querytable action= "Listep.action" editormeta= "editor"
title= "Query Criteria"/>
<web:tablelist action= "listep.action?method=list" Headermeta= "header"
Hiddenmeta= "hidden" title= "query Result" showlist= "hidden" top= "false"
Mode= "Radio"/>
</s:else>
</div>
</body>
<script language= "JavaScript" type= "Text/javascript" >
For departmental Queries
$ ("#queryBtn"). Removeattr (' onclick '). Click (
function () {
var obj = document.forms[' queryform '];
obj.action = ' <s:url value= '/listep.action '/> '
+ '? deptid= ' + document.getElementById (' DeptID '). Value;
Obj.submit ();
});

The value to pass when the page is opened
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", "Double-click to select");
JQuery (". All_border. HS Tbody tr:gt (0)"). Removeattr (' ondblclick ')
. DblClick (
function () {
The value list () in the hidden field is fetched
var name = $ (this). Find ("Input[name= ' name ']")
. Val ();
var Deptname = $ (this). Find ("Input[name= ' Deptname ')"). Val ();
var DeptID = $ (this). Find (
"Input[name= ' DeptID ']"). Val ();
The usual value
var Deptname = $ (this). Children (). EQ (2). Text ()
var info = $ (this). Children (). EQ (a). Text ()
. Split (";") [0];
if (info = = "") {
info = "No route";
}
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 ' > Company: </td><td class= ' R_border ' > <input type= ' text ' value= ' "+deptname+" ' id= ' deptname ' name= ' deptname ' ' class= ', ' input_sytle_1 ' Align= ' right ' > license plate number: &LT;/TD&GT;&LT;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 ' Input_sytle_1 ' ></td></tr></tbody> ');
var tree = initdropdowntree (' Orgtree '),
' <s:url value= '/commonpage.action?method=getorgtree '/> ');
Settextboxtree (' Deptname ', ' deptid ', ' orgtree ', tree);
});
</script>

JSP referenced JS code fragment

Copy Code code as follows:

<script language= "JavaScript" type= "Text/javascript" >
Another page
The number of IDs on this page is based on the decision of another page.
function Selplateno (plateno,deptname,deptid,info)
{
var ret = Openwin ("Listep.action?method=list&flag=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];

}
}

Load Picture Display another page
$ (document). Ready (function () {
//
$ ("#plateno"). After ("\ ' alt=\ ' select ' border=\ ' 0\ ' > ');
});
</script>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.