Use the XML configuration interface to work with static pages
You can work with static portal pages by using the portal XML configuration interface. Learn about the tasks that you can perform and the XML elements for working with static pages.
For more detailed information about the portal XML configuration interface, how to use it, and where the sample file are located, refer to the appropriate section of the portal information center.
Export a static content page
Export a static page works similarly to exporting a standard portal layout page. The following is an example. You can adapt it and use it to export a static page. Sample file ExportStaticPage.xml
<?xml version="1.0" encoding="UTF-8"?> <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_6.1.0.xsd" type="export"> <portal action="locate"> <content-node action="export" uniquename="samplestaticpage1"/> </portal> </request>The next example extends the example above to include the portlet that is contained on the static page in the export. The resulting XML file contains the complete configuration data of the portlet and the page. Sample file ExportPortletAndStaticPage.xml
<?xml version="1.0" encoding="UTF-8"?> <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_6.1.0.xsd" type="export"> <portal action="locate"> <web-app action="export" uid="BlurbPortlet.3088d83ae7690017105c9e64cce97eb8"/> <content-node action="export" uniquename="samplestaticpage1"/> </portal> </request>
Import a static content page
Import a static page works similarly to importing a standard portal layout page. The following is an example. You can adapt it and use it to import a static page. It shows the following additional possibilities:
- It assumes that the portlet is already installed. Therefore it uses only a locate action for the Web module, and not an update action.
- It shows how you can specify the content of static page in binary format. To obtain the binary format content, export the page by using the XML configuration interface.
- You can export the result to generate a template for your XML scripts.
Sample file CreateStaticPage.xml
<?xml version="1.0" encoding="UTF-8"?> <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_6.1.0.xsd" type="update" version="6.1.0.0" <portal action="locate"> <theme action="locate" domain="rel" objectid="ibm.theme" uniquename="ibm.portal.theme.IBM"/> <web-app action="locate" domain="rel" uid="BlurbPortlet.3088d83ae7690017105c9e64cce97eb8"> <servlet action="locate" domain="rel" referenceid="Portlet_1"/> <portlet-app action="locate" domain="rel" name="Information Portlet Application" uid="BlurbPortlet.3088d83ae7690017105c9e64cce97eb8.1"> <portlet action="locate" domain="rel" name="Welcome to WebSphere Portal" objectid="portlet1" uniquename="wps.p.Welcome To WebSphere Portal"/> </portlet-app> </web-app> <content-node action="locate" domain="rel" objectid="homepage" uniquename="ibm.portal.Home"/> <content-node action="update" active="true" allportletsallowed="true" content-parentref="homepage" create-type="explicit" domain="rel" ordinal="1500" themeref="ibm.theme" type="staticpage" uniquename="samplestaticpage1"> <localedata locale="en"> <title>Sample Static Page 1%/title> </localedata> <pagecontents markup="html" display-option="inline"> <content>UEsDBBQACAAIALKbTDcAAAAAA . . . . . 5AAAAGQEAAAAA</content> </pagecontents> <parameter name="com.ibm.portal.static.page.file.name.html" type="string" update="set"> <![CDATA[index1.html]]> </parameter> <access-control externalized="false" owner="uid=wpsadmin,o=defaultwimfilebasedrealm" private="false"/> <component action="update" active="true" domain="rel"ordinal="100" orientation="V" type="container"> <component action="update" active="true" domain="rel" ordinal="100" orientation="V" type="container"/> <component action="update" active="true" domain="rel" ordinal="100"orientation="H" type="container"> <parameter name="com.ibm.portal.layoutnode.localname"type="string" update="set"> <![CDATA[portletContainer1]]> </parameter> <component action="update"active="true" domain="rel" ordinal="100" type="control"> <parameter name="com.ibm.portal.layoutnode.localname" type="string" update="set"> <![CDATA[portletWindow1]]> </parameter> <portletinstance action="update" domain="rel" portletref="portlet1"/> </component> </component> </component> </content-node> </portal> <status element="all" result="ok"/> </request>
Import a static content page from a ZIP file
You can also import a static page from a zipped resource file. The following is an example. You can adapt it and use it to import a static page from a ZIP file. It shows the following additional possibilities:
- It assumes that the portlet is already installed. Therefore it uses only a locate action for the Web module, and not an update action.
- It shows how you can specify the content of static page from a ZIP file.
Sample file CreateStaticPageFromZip.xml
<?xml version="1.0" encoding="UTF-8"?> <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_6.1.0.xsd" type="update" version="6.1.0.0" <portal action="locate"> <theme action="locate" domain="rel" objectid="ibm.theme" uniquename="ibm.portal.theme.IBM"/> <web-app action="locate" domain="rel" uid="BlurbPortlet.3088d83ae7690017105c9e64cce97eb8"> <servlet action="locate" domain="rel" referenceid="Portlet_1"/> <portlet-app action="locate" domain="rel" name="Information Portlet Application" uid="BlurbPortlet.3088d83ae7690017105c9e64cce97eb8.1"> <portlet action="locate" domain="rel" name="Welcome to WebSphere Portal" objectid="portlet1" uniquename="wps.p.Welcome To WebSphere Portal"/> </portlet-app> </web-app> <content-node action="locate" domain="rel" objectid="homepage" uniquename="ibm.portal.Home"/> <content-node action="update" active="true" allportletsallowed="true" content-parentref="homepage" create-type="explicit" domain="rel" ordinal="1500" themeref="ibm.theme" type="staticpage" uniquename="samplestaticpage1"> <localedata locale="en"> <title>Sample Static Page 1</title> </localedata> <pagecontents markup="html" display-option="inline"> <url>file:///$server_root$/doc/xml-samples/index1.zip</url> </pagecontents> <parameter name="com.ibm.portal.static.page.file.name.html" type="string" update="set"> <![CDATA[index1.html]]> </parameter> <access-control externalized="false" owner="uid=wpsadmin,o=defaultwimfilebasedrealm" private="false"/> <component action="update" active="true" domain="rel" ordinal="100" orientation="V" type="container"> <component action="update" active="true" domain="rel" ordinal="100" orientation="V" type="container"/> <component action="update" active="true" domain="rel" ordinal="100" orientation="H" type="container"> <parameter name="com.ibm.portal.layoutnode.localname" type="string" update="set"> <![CDATA[portletContainer1]]> </parameter> <component action="update" active="true" domain="rel" ordinal="100" type="control"> <parameter name="com.ibm.portal.layoutnode.localname" type="string" update="set"> <![CDATA[portletWindow1]]> </parameter> <portletinstance action="update" domain="rel" portletref="portlet1" /> </component> </component> </component> </content-node> </portal> <status element="all" result="ok"/> </request>
Parent topic:
Include static content pages in the portal
Related tasks
Creating a static page
Updating a static page
Lock and unlock static page content
Related reference
Scripting for static pages