From http://libweb.zju.edu.cn:8080/04/guanjiaoliu/Article/j1.htm Web Search Interface Dynamic Generation Realization Example Address 1 Question out with the wide use of Internet technology, construction of network resources And sharing is particularly important. As the collection of resources, the library has gradually moved to the digital construction of information. In addition to purchasing data suppliers, according to the needs of users and the characteristics of the library, they have built many distinctive databases, and through the web page Dynamically interactive or static supply to the reader. However, since these resources are self-built by the libraries, the retrieval method is different, and the web page is also relatively scattered, causing difficulties in maintenance of web pages. With the increase of information resources, the quality of service of improving information resources is gradually focusing on digital construction, in which a unified and friendly retrieval interface is not losing an important service means for readers to effectively utilize information resources. This article is based on this, proposes the viewpoint of the web retrieval interface dynamic generated, that is, dynamically generates the web search interface, and the generated interface is except that other content and usage methods in the interface except for the selection of the search. This article details the process of realizing the dynamic generation of web retrieval interfaces using ASP technology. 2 Web Data Interface Technology: ASP and ADO ASP (Active Server Pages) Techniques are a server-side command execution environment in Microsoft, which establishes and performs dynamic interactive web server applications with HTML, Script (Script) and ActiveX components. Since the ASP script can reference the system components and ASP built-in components, the ASP program can easily access the database to implement a powerful dynamic Web information service system. ADO (Active Data Objects) is an ASP built-in ActiveX server component, which is an object model that contains Connection, Command, Recordset objects. Where the Connection object is used to establish a connection with the database, Command is used to define commands to operate on the database source, such as SQL language such as SELECT, INSERT, DELETE, UPDATET. The Recordset object is used to store the result set formed after the database execution command is submitted. Because ADO provides functions of connecting an ODBC data source or OLE DB data source, network developers can easily connect with multiple databases. 3 Unified Retrieving Interface Dynamic Generation Implementation 3.1 Search Interface Structure Currently, Internet Retrieval Search is divided into three: field mode, Boolean logic value and natural language mode, because this article is based on a database-based search, therefore selected the first two ways Dynamically retrieving the search mode. The search interface is shown in Figure 1: Figure 1 Dynamic retrieval interface structure diagram Dynamic retrieval interface There are two ways to implement multiple conditional retries: (1) By selecting fields, enter the retrieval value and select the logical operator, then press Add Condition button to Realize the composition of multi-condition logical expressions; (2) Finish directly in the Boolean logic input box. 3.2 Retrieval Interface Parameter Settings Since the retrieval interface is automatically generated according to different data sheets, the display format of the search interface and the retrieval return result is not regularly implemented by the settings of the parameter table. The following 3 is set according to the software needs. Parameter table. 3.2.1 Retrieving Field Parameter Table Retrieval Field Parameter Table Record some information for the field used for data table retrieval, and retrieve the interface to generate the contents of the searcher in the hyperlink to automatically generate the contents of the search field. Further, when the user retrieves the result, the program is displayed in the interface in the form of the setting in the form of the parameter table.
Table 1 shows: Table 1 Retrieve field parameter table (Table Name: WebFind) field name field meaning TNAME Data table name indexname Datasheet index field (ie "Name Fieldn Retrieval field name FieldZn Retrieval field Chinese meaning FieldType search Field Data Document 3.2.2 Recording Details Field Parameter Table Record Details Field Parameter Table For controlling the detailed display of the record, after the user enters the keyword to retrieve, the program is returned to the user, the list The data of the column is the data contained in the search field set by Table 1, and the user needs to display the hyperlink in the list, and the displayed data content is done by setting the detailed display field parameter table. Decomposition: Table 2 Detailed Display Field Parameter Table (Table Name: WebTable) Field Name Field Meaning Tablename Data Table Name LSH Series, Deciding Display Field Order FieldName Display Field Name FieldZnzw Display Field Name FieldZnzw Display Field meaning FieldType Display Field Data Document DROPTABLE * If FieldName exists in the data table in the code form, record the associated code table name DROPCODE * code table represents the word value of the code value DROPNAME * code table in the code table in the code table : * If the field in the data table is existing in the form of a code, you need to set the corresponding value, otherwise it can be empty. 3.2.3 Recording the case of the data table related UNU table If a table is connected to several sub-tables, you need to set the parameter table. Such as book databases, including bookmarks, collections, and circulation tables, design a key field, and contact the bookmark table with the library table and circulation table. When the bookmark information is displayed in detail, the bibliographic collections and circulation are displayed by hyperlinks, without retrieving the library table and circulation table. Table 3 shows: Table 3 Data Table Related Union Table Situation Parameter Table (Table Name: Subtable) Field Name Field Meaning FNAME Data Table Name SubtName Related Union Table Name ZtName Related Wild Table Interface Show Chinese Name LinkName Data table with the associated sub-table link field name LINKTYPE LINKNAME field recorded data Data INDEXNAME Related UNU Index Data INDEEPE Data Type 3.3 Unified Retrieval Interface Dynamic Generating Program Design Procedure The core includes the following four parts: mul_find.asp, bfind.asp, showtable.asp, showsubtable.asp. The order of the four programs is: mul_find.asp → bfind.asp → showtable.asp → showsubtable.asp.
Since the program implements dynamic interaction with the web data, you need to enter the following code in Global.asa: Sub Application_onstart Application = "DSN = DS name; UID = e User Name; PWD = Password" Application (" cx_ConnectionTimeout ") = 15 application (" cx_CommandTimeout ") = 30 application (" cx_CursorLocation ") = 3 application (" cx_RuntimeUserName ") =" user name "application (" cx_RuntimePassword ") =" password "End Sub longer codes because the program, Therefore, this article only lists the key parts therein. If you need the source code for the entire program, you can contact your own. 3.3.1 MUL_FIND.ASP Implement Unified Retrieval Interface Dynamic Generation, the generated interface is shown in Figure 1. This program has two parameters: dbname and where. Call mode:
. The source code code is as follows: ... function select1_onclick () // field selection script {var vn = document.form1.select1.value; var Fieldn = Vn.Substring (0, vn.length-2); document.form1.text1 .value = fieldn;} Function button1_onclick () // Add condition button script {var = document.form1.select3.value; var ss1 = document.form1.select1.value; var type = ss1.substring (ss1.length- 1. SS1.LENGTH; var fs = document.form1.text1.Value; var vs = document.form1.text2.Value; var ps = document.form1.select2.value; var ts = ''; ts = document. Form1.textarea1.value; if (Ts.Length> 1) {TS = TS '' RS '';} f (Types == 'S') // s represents the character type {IF (ps == ' = ') {Ts = TS FS ' ' PS ' ' ' | ' VS ' | ';} else {TS = TS FS ' ' PS ' ' ' |% ' VS '% |';}} else {if (type == 'd') // D represents the date type {if (vs.length == 10) // indicates YYYY-MM-DD {TS = TS FS '' ps '' '|' vs '|';} else {if (vs.length == 7) // Represents YYYY-mm {TS = TS "Year (" fs ") = " vs.substring (0,4) " and month (" fs ") = " vs.substring (5, 7);} else {ts = ts " YEAR (" fs ") = " vs.substring (0, 4);}}} // means YYYY ELSE {TS = TS VS; }}} Document.form1.textarea1.Value = TS; Document.form1.submit1.disabled = false;} The above is the script code for the selection and increase the conditions in the selection and increase the condition of the two-to -_clicked events in JavaScript.