Bayi. Domino View Web Presentation technology

Source: Internet
Author: User
Tags xsl xslt

Displaying large amounts of data in a list is one of the most common and basic requirements in various development. In the web development of the relational database, the programmer has to deal with two separate tasks, one is to query the records from the database and the other is to generate HTML to display the data in the view layer. How paging is a major problem. Domino's interface-oriented development style and document-based database, which are not suitable for dynamic querying, make programmers face completely different situations and problems. The pre-designed view not only defines the included documents, but also sets the appearance attributes, which combine the functions of the data and appearance layers. In the client, the view has the same appearance as the design, without programming. On the web side, because Domino's default generated view HTML is too primitive, programmers need a variety of ways to improve their appearance and operability. Here's a breakdown of the Domino View Web presentation technology I've been exposed to and used, and a simple analysis and evaluation.

1. HTML generated using Domino

Advantages:

    • No programming required.

Disadvantages:

    • Show primitive crude.

2. Using applets

Advantages:

    • No programming required.
    • The operation is consistent with the client.

Disadvantages:

All the disadvantages of the applet, including:

    • The user's machine needs to be installed in the Java runtime, although most of the machines are now installed.
    • You need to download and load applets at a slower speed.
    • Inconsistent with the overall style of the Web page.
    • IBM has already abandoned its updates, actually since JAVA7 Update 51 because there is no Java runtime required permission properties (Permission Attribute) Domino's own applets are not available to run in the browser.

3. Display the contents of the view as HTML

This method requires that the final HTML be generated within the column formula of the view.

Advantages:

    • You can customize the displayed content in fine detail.

Disadvantages:

    • Clumsy and cumbersome, difficult to maintain.
    • This view can only be used for web display and cannot be generalized to client display and background queries.
    • A large number of HTML calculations in a column have a negative effect on the speed and size of the view index.

4. Adjust the adornments with JavaScript after the view original HTML is loaded

A common method used in Domino's early web development to run a script in the OnLoad event of the page displaying the view, modifying the original HTML of the view. The view HTML generated by Domino is primitive, ugly, quirky, and always not improved, and using this method requires a thorough understanding of the details of the HTML.

Advantages:

    • The ability to fully customize the display of a view to modify it to any desired appearance.
    • The script is flexible enough to be able to coordinate with the agent to get the view's appearance properties to set column widths, headings, etc. without manually entering parameters.

Disadvantages:

    • JavaScript development is required (it can be written as a common function for all views, only one development), and the modifications to HTML are not logically understandable and can only be hardcoded based on the HTML generated by Domino. For example, the following fragment:

1. Delete the last cell of the header row//strdiv = Strdiv.replace (/<th><\/th><\/tr>/g, "</TR>");//2, delete the last cell of the category row/ /strdiv = Strdiv.replace (/<td><\/td><\/tr>/g, "</TR>")//3, delete the last cell of each content row//strdiv = Strdiv.replace (/<td><\/TD>< \/tr>/g, "</TR>");
Code is difficult to understand and maintain.

    • Once domino modifies the HTML generated by the view, it needs to be re-observed and the code adjusted accordingly.
    • The original view may be displayed first when the page is loaded, and the adjusted view will be displayed after the delay of the script run.

5. Using JavaScript to read the contents of the view XML or JSON

This approach is a major breakthrough in Domino View Web presentation, where the Domino server sends the view-only content data to the browser, without any appearance information, such as fonts, colors, and so on, under the Readviewentriesurl command. The HTML that reads it to generate the display view is completely dependent on JavaScript scripts and CSS. These front-end files form a separate view layer and thus have the greatest flexibility ever. This approach has been used by many companies and open source code before the advent of xpages.

Advantages:

    • Have all the advantages of a fourth approach without most of its drawbacks.
    • Can load multiple views on a single page.

Disadvantages:

    • JavaScript development is required to master the relevant XML knowledge and to understand the data formats produced by Readviewentries.

6. Transforming the view's XML data using XSLT technology

As I approached the previous method, I thought that since the XML data for the view could be obtained, it should also be possible to transform this XML into HTML for display using XSLT within the XML technology family. Here's my test code and display:

<?xml version= "1.0" encoding= "iso-8859-1"? ><xsl:stylesheet version= "1.0" xmlns:xsl= "http://www.w3.org/ 1999/xsl/transform "><xsl:output method= ' html ' version= ' 1.0 ' encoding= ' UTF-8 ' indent= ' yes '/><xsl: Template match= "/" > 


You may notice that the date and time column in does not parse the original datetime string. This is because in the XSLT 1.0 standard I experimented with, there was neither a convenient date-formatted function nor a custom function. Now that XSLT has been upgraded by 2.0, both of these aspects have improved. However, compared with JavaScript, using XSLT to generate HTML is subject to XML-style syntax, more importantly, there is no good error and debugging mechanism, slightly wrong, the page will only show a blank, it is difficult to find the source of the error.

Advantages:

    • The ability to fully customize the display of a view to modify it to any desired appearance.

Disadvantages:

    • XSLT programming is required, and syntax is cumbersome and difficult to debug.
    • It is not as flexible as a JavaScript-based scenario, such as dynamically fetching the view's appearance data from the server.

7. View controls in Xpages

Xpages finally brought Domino's web development into the modern age. The view display on the web also achieves the same results as the client at design time, resulting in a simple and elegant display of the view control's default generation. Because of the JSF architecture, Domino delivers to the server the HTML generated by the view control render, not the XML of the first two methods. The Partialrefresh property of a paging device (pager) In a view control determines whether the page is refreshed or partially refreshed (that is, with Ajax).

Advantages:

    • No programming required.
    • Easy to adjust appearance at design time.
    • A view can be presented in different ways with multiple view controls, saving the number of background views and improving database performance.
    • A page can display multiple views.

Bayi. Domino View Web Presentation technology

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.