2011年7月25日星期一

WebCenter_023:OmniPortlet使用指南之一:访问CSV数据

OmniPortlet可以让开发人员快速把各种数据源(spreadsheet,XML,Web services,RSS feed,database,外部应用页面的数据),以Web页面的形式发布。
开发工具:JDeveloper 11.1.1.5.0。
重要步骤说明:

1. 创建一个WebCeneter Portal 应用。

2. 注册OmniPortlet


这里为了简单起见,使用的是内嵌的WebLogic Server上的OmniPortlet。
http://127.0.0.1:7101/portalTools/omniPortlet/providers/omniPortlet


3. 创建一个页面,拖放注册的OmniPortlet
注意,新页面要符合Portal Project的规范,应该放在和home.jspx同级的目录下,不要乱放。


4. 运行Portal应用,登录后,定制化OmniPortlet。
OmniPortlet是一个“半配置”的Portlet,需要运行时做定制化才能使用。


tours.csv文件内容如下:
tour_id,country_id,tour_name,tour_desc,duration,image_url,price
F1,1001,Evening in Paris,"Savor the ambiance of this romantic city. This tour starts with a moonlit, champagne dinner-dance aboard a bateau-mouche, cruising down the Seine. After a tour through the historic Montmartres district, you will take in a fabulous Moulin Rouge show featuring the French CanCan at this atmospheric cabaret. Tour price (includes a four course gourmet dinner; wine is extra): $129 (airfare not included)",1 special evening,evening_in_paris.jpg,$129.00
F2,1001,Canals of France,"Come aboard one of France's most authentic and beautiful boutique hotel barges. The itinerary features the Languedoc, one of Southern France's most fascinating regions, recently dubbed the next Provence. Our waterway is the picture-perfect 300 year old Canal du Midi, designated a UNESCO World Heritage Site and considered to be the prettiest canal in France. This tour rivals none for its picturesque scenery and relaxed pace. Tour price: $499 (based on double occupancy, airfare not included)","3 days, 2 nights",canals_of_france.jpg,$499.00
I1,1002,Viva Venice,"The romance of Venice, with its maze of canals, rustic piazzas, arched bridges, rustic palaces, charming gondoliers, and bustling water traffic, is simply like no other place on earth. This tour includes all the popular tourist sites such as St. Mark's square, the Doge's palace, and a visit to see Venetian glass blowers plying their trade on the island of Murano. Tour price: $999 (based on double occupancy, airfare not included)","3 days, 2 nights",viva_venice.gif,$999.00
I2,1002,Roman Holiday,"Revel in the culture and cuisine of the Eternal City, which is positively steeped in history. Our day tours, which include visits to St. Peter's Square, Vatican City, the Roman Forum, and the Colosseum, feature local guides who are 100% fluent in English. You'll also have plenty of time for sipping a cappucino at a sidewalk cafe and for doing your own shopping and exploring. Tour price: $899 (based on double occupancy, airfare not included)","3 days, 2 nights",rome_tour.gif,$899.00
I3,1002,Tuscany Treking,"A perfect family holiday--enjoy an exhillarating combination of walking, culture, and exploration. We've designed this tour for adults and kids alike, allowing plenty of time for meandering through medieval villages as well as strolling through vineyards and olive groves. Every night is spent at a different family-style hotel, where your luggage will await you. Tour price: $1,210 based on double occupancy, airfare not included).","10 days, 9 nights",tuscany_trek.gif,"$1,210.00 "
I4,1002,Mediterranean Sand & Sea,"Come, oh sun seekers, to bask in comfort and style on the sandy shores of the Mediterranean. Tour includes accommodation at a four star hotel, continental breakfasts, and free shuttle service to your choice of golden beaches. Tour price: $764 (based on double occupancy, airfare not included)","5 days, 4 nights",sun_and_sand.gif,$764.00
B1,1005,Bali Homestay,"Mingle with Balinese people, experience their daily way of life, while learning their language, cooking, and culture in a traditional Balinese village. Proceeds from this program are donated to participating villages to improve their education programs and facilities. We guarantee that, after a week as a welcome guest in a Balinese household, you will never be a stranger in Bali again! Tour price: $999 (airfare not included)","7 days, 6 nights",bali_homestay.jpg,$999.00
B2,1005,Bali Culture,"Balinese dance, painting, shadow puppets, cremation ceremony, and kite flying are just a few of the cultural attractions that make Bali the ideal tour destination. On this tour, you'll make Ubud village your travel hub where almost nightly a variety of dances are performed in village compounds. Ubud is world renouned for its wood carving, painting, and other handicrafts. The Ubud Traditional Art Market is an absolute must to see.Tour price: $764 (based on double occupancy, airfare not included)","5 days, 4 nights",bali_culture.jpg,$764.00
NZ1,1006,South Island Sojourn,"The South Island of New Zealand is a true adventure and outdoor paradise. On this combination adventure and sight-seeing tour, you'll explore the cities and towns, mountains, lakes, rivers, and sea coast of the South Island. You'll also have your choice of a variety of adventure experiences, including caving, rafting, canoeing and kayaking, surfing, jetboating, jet skiing, glacier walks, scenic flights, mountain biking, horse treks, fishing, and gold panning--who could ask for more?","5 days, 4 nights",milford_sound.gif,$750.00
A1,1008,Trasmania Trek,"More than 30% of the island state of Tasmania is protected by World heritage areas, National parks, and nature reserves. This makes Tasmania your perfect trekking destination. Imagine yourself walking in Australia's largest temperate rainforest, surrounded by the timeless grandeur of rugged mountain ranges, wild rivers, and cascading waterfalls. Here's your golden opportunity for getting away from it all. Trips available year round.","5 days, 4 nights",tasmania_trek.gif,$825.00
A2,1008,Outback Adventure,"This three day experience includes camping under the huge, starry desert skies, enjoying traditional Aussie meals around a camp fire (complete with a ""camp oven""), and, of course, a visit to such awe inspiring sights as Kings Canyon, the Olgas, and Ulhuru. Experience breath-taking views of Australia's most famous attraction, Ayres Rock (Uluru), which is a massive red rock that protrudes high from the seemingly barren lands that surround it. Here's your chance to view the rock both at sunset and dawn when the sun's reflection makes turns it bright red.","3 days, 2 nights",ayers_rock.gif,$395.00
N1,1010,Darjeeling Delight,"Known as the Queen of the Hill Stations, Darjeeling is internationally famous for its tea industry and the Darjeeling Himalayan Railway, a UNESCO World Heritage Site. Other sights include the Tenzing Norgay Himalayan Mountaineering Institute, which trains mountaineers and has a fascinating small museum, and the Padmaja Naidu Himalayan Zoological Park. A dawn visit to the Tiger Hills is a must for all Darjeeling visitors who want to see sunrise over the Mt Kanchenjungha.Tour price: $999 (based on double occupancy, airfare not included)","5 days, 4 nights",darjeeling_sojourn.gif,$999.00
N2,1010,Golden Triangle,"The Golden Triangle is an excellent introduction to India for first-time visitors. On this tour, you will view the ancient and modern attractions of Delhi, the unparalleled Taj Mahal in Agra, and the exotic forts and palaces of Jaipur. Without a doubt, the Golden Triangle tour is one of the most popular tourist circuits of India. Tour price: $1199 (based on double occupancy, airfare not included)","6 days, 5 nights",golden_triangle.gif,"$1,199.00 "


设置一个初始过滤条件,并且设置一次最多返回两个结果。

Layout Style选择HTML。

不重复的表头部分
<table width="600">
重复的表行部分,注意OmniPortlet会自动分析CSV数据,索引方式为:“##列头名称##”。
特别注意,图片的路径写法:
<tr>
<td width="200">
<font class="PortletHeading1">##tour_name##</font>
</td>
</tr>
<tr>
<td>The duration of the <font class="PortletHeading2">##tour_name##</font> tour is <font class="PortletHeading2">##duration##</font>. Price from <font class="PortletHeading2">##price##</font>.
</td>
</tr>
<tr>
<td width="500">
<div style="float: right; clear: left;"><img src="./images/##image_url##" valign="top"></div>##tour_desc##
</td>
</tr>
不重复的表尾部分
</table>

5. 重新运行Portal应用,查看OmniPortlet,结果如下:登录后,定制化OmniPortlet。


Project下载:Veeva_OmniPortlet.7z

没有评论: