Aeai portal-full-dynamic Portlet Configuration

Source: Internet
Author: User
1. Overview

Full-dynamic Portlet, as its name implies, means that all the displayed content is dynamic, including the display style and data. The display style is set through the HTML template, and the data can have multiple sources: common ESB message flows are provided, constructed by handler, or configured through static data in portal management.

2. Data Template Configuration

A full dynamic template is an HTML template that defines the data display mode and style in the template. It is equivalent to wearing a coat for data. You can flexibly set styles as needed, such as table tables and UL lists. The following is a full-dynamic template sample for detailed description.

Go to data template> component template in portal management:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4D/11/wKiom1RKG1rzOiX1AAOmC44ugXM737.jpg "Title =" 111.png" alt = "wkiom1rkg1rzoix1aaomc44ugxm737.jpg"/>

Add a template, double-click the pop-up box, and fill in the following content:

<# Assign model = text? Eval>

<Divstyle = "Background: #960;" >$ {model. name} </div>

<Div>

<Table width = "100%" border = "1">

<# Listmodel. datas DATA>

<Tr>

<TD >$ {data. ID} </TD>

<TD >$ {data. Title} </TD>

</Tr>

</# List>

</Table>

</Div>

In the preceding template, the assign command is used to create or replace a top-level variable for the template page. The text object represents the text input field in the HTML form, and the eval parameter represents dynamic parsing.

After the Data URL is configured, the background processing class corresponding to the All-dynamic Portlet puts the JSON data into the model, and then the data in the model can be traversed.

<# List> </# list> is the freemarker's traversal command. If the JSON name/value pair is directly placed in the returned data, it is taken directly from the model; if the name/value pair is placed in jsonarray, it needs to be traversed through the # LIST Command, and jsonarray is put in the above datas. So we need to traverse from datas. The value is obtained using the El expression $ {xx. xx.

3. Data Source construction 3. 1. It is provided through the ESB Message Flow

The data can be queried by the database or manually constructed.

If the data comes from the database, first query the required data through the query node, and then construct JSON data in javainvoker. Through a loop, the data in datarow is first retrieved and put into jsonobject by field name, and then added to jsonarray. jsonarray can be directly returned as a result, so the data will be traversed from the model; you can also put jsonarray into jsonobject and then return it, for example, jsonobject. put ("datas", jsonarray);, the template above corresponds to this method.

The method for converting manually constructed data to JSON data is the same as above, except that the data source is different.

After the message flow is created, deploy it and copy the access address (for example) of the Message flow to the Data URL of the dynamic Portlet.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4D/11/wKiom1RKG6OTwBQ-AACEMNmpa6s752.jpg "Title =" 222.png" alt = "wKiom1RKG6OTwBQ-AACEMNmpa6s752.jpg"/>

If a parameter is input, the parameter value must be provided.

. Provide Handler through data construction

You can also query the database to obtain data, or manually construct data through the data construction class.

The data is converted to JSON format in handler. It can be implemented in a method and called in preparedisplay to return the result.

Call the handler in the Portlet and enter the following path in the Data URL:

Http: // localhost: 8080/portal_portlets/resource? Staffreportdataprovider & resourcetype = histogram & year =$ {year}

Portal_portlets is the application name, And staffreportdataprovider is the handlerid of the handler constructed from the corresponding data, followed by the parameters to be passed.

3.3 static data configuration managed through portals

Go to the data template --> static data:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4D/11/wKiom1RKG-_BNX4yAALfPEB6d8I051.jpg "Title =" 333.png" alt = "wKiom1RKG-_BNX4yAALfPEB6d8I051.jpg"/>

Add JSON static data. Double-click the pop-up box and fill in the following content (JSON data ):

{"Datas": [{"ID": "25d8f5ff-e19f-4684-b668-94b7172df636", "text": "database resource", "url": "http: \/localhost: 9090 \/smc \/index? Dbresourcemanagelist "," height ":" 500 "},{" ID ":" 4bf8a7b3-508b-4050-bdc8-5b54ee643123 "," text ":" encoding type "," url ":" http: \/localhost: 9090 \/smc \/index? Codetypemanagelist "," height ":" 500 "}]}

The JSON data format is not described here. If you are interested in it, you can go into details.

After saving, click Edit to copy the address to the Data URL of the Portlet:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4D/11/wKiom1RKHCfRAForAAClbTsHviI887.jpg "Title =" 444.png" alt = "wkiom1rkhcfraforaaclbtshvii887.jpg"/>

4. Configure the Portlet

Create a page that contains a fully dynamic Portlet in the portal, for example:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4D/12/wKioL1RKHKzh_LFMAADh-EL_-jM245.jpg "style =" float: none; "Title =" 555.png" alt = "wKioL1RKHKzh_LFMAADh-EL_-jM245.jpg"/>

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4D/11/wKiom1RKHF2T5BH-AAEEE1ThXM4160.jpg "style =" float: none; "Title =" 666.png" alt = "wKiom1RKHF2T5BH-AAEEE1ThXM4160.jpg"/>

"Tempate8jsonmergeportlet" is the full-dynamic Portlet code. Configure the Portlet on the corresponding page of the portal, as shown below:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4D/12/wKioL1RKHMXwIgXsAAE3Wj36FD0178.jpg "Title =" 777.png" alt = "wkiol1rkhmxwixsaae3wj36fd0178.jpg"/>

You must configure the HTML template and Data URL, copy the template address configured in the background to the HTML template, and enter the corresponding data path to display the data. The default value is dynamic parsing, And the HTML tags in the data cannot be parsed. Static parsing can parse tags, but only applies to one data record. Other content can be configured as needed.

The display effect is as follows:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4D/12/wKioL1RKHN2CR99IAABffl-FVhM776.jpg "Title =" 888.png" alt = "wKioL1RKHN2CR99IAABffl-FVhM776.jpg"/>


Aeai portal-Download Full-dynamic Portlet configuration document

This article is from the "shutong changlian Portal Integration Platform" blog, please be sure to keep this source http://aeaiportal.blog.51cto.com/9300497/1567679

Aeai portal-full-dynamic Portlet Configuration

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.