Designing and Implementing Composite Applications : webMethods CAF Development Help : Working with Facelets : Example: Inserting a Form Into a Portlet
Example: Inserting a Form Into a Portlet
This topic provides an example of inserting an .xhtml form into an existing portlet using the Facelets templating tags. Typically, a user interface is assembled by rendering a set of portlets that are responsible for drawing a fragment of the larger page. In this case, you can implement a form to import into one of those portlets, providing you with a greater amount of flexibility in creating your portlet page.
This example demonstrates the following files:
form_template.xhtml
This file defines the tags for your form:
<ui:composition x mlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:caf_h="http://webmethods.com/jsf/caf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:h="http://xmlns.jcp.org/jsf/html">
 
    <caf_h:formattedMessages id="errorMessages"/>
    <caf_h:form id="form">
 
    <ui:remove> TODO: your generated form elements here </ui:remove>
    </caf_h:form>
</ui:composition>
portlet_example.xhtml
This file demonstrates inserting the form_template.xhtml file into the body of a portlet:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<caf_f:view xmlns="http://www.w3.org/1999/xhtml"
    xmlns:caf_f="http://webmethods.com/jsf/caf/core"
    xmlns:caf_h="http://webmethods.com/jsf/caf/html"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    pageManagedBean="ExampleDefaultviewView" preferencesBean="Example">
    <caf_f:design-time-attribute name="portlet" value="example"/>
 
    <ui:remove> Include the template here </ui:remove>
    <ui:include template="/form_template.xhtml"/>
 
</caf_f:view>
simple_standalone_page_example.xhtml
This file demonstrates inserting the form_template.xhtml file into the body of a simple standalone page without a My webMethods Serverheader/footer:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www. w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:caf_f="http://webmetho ds.com/jsf/caf/core"
      xmlns:caf_h="http://webmethods.com/jsf/caf/html"
      xmlns:mws_ui="http://webmethods.com/jsf/mws_ui">
<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=8"/>
    <title>#{htmlHead.systemTitle}</title>
    <mws_ui:scripts />
</h:head>
<h:body>
    <mws_ui:pre_body />
    <ui:remove> Include the template here </ui:remove>
    <ui:include template="/form_template.xhtml"/>
</h:body>
</html>
mws_framed_standalone_page_example.xhtml
This file is similar to simple_standalone_page_example.xhtml, but with the My webMethods Server shell (header/footer/leftnav) rendered around the page content:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:caf="http://webmethods.com/jsf/caf/fn"
      xmlns:caf_f="http://webmethods.com/jsf/caf/core"
      xmlns:caf_h="http://webmethods.com/jsf/caf/html"
      xmlns:mws_ui="http://webmethods.com/jsf/mws_ui"
      >
<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=8"/>
    <title>#{htmlHead.systemTitle}</title>
    <mws_ui:scripts />
</h:head>
<h:body>
    <mws_ui:pre_body />
    <div id="page">
        <div id="nonFooter">
            <div id="header">
                <ui:remove> shell header </ui:remove>
                <mws_ui:resource renderer="shell">
                    <f:attribute name="shell.subrenderer.layout.name" value="head"/>
                </mws_ui:resource>
            </div>
            <div id="body">
                <div id="leftnav">
                    <ui:remove> shell left </ui:remove>
                    <mws_ui:resource renderer="shell">
                        <f:attribute name="shell.subrenderer.layout.name" value="left"/>
                    </mws_ui:resource>
                </div>
 
                <div id="rightnav">
                    <ui:remove> shell right </ui:remove>
                    <mws_ui:resource renderer="shell">
                        <f:attribute name="shell.subrenderer.layout.name" value="right"/>
                    </mws_ui:resource>
                </div>
 
                <ui:remove> page content </ui:remove>
                <div id="portal-content" class="content">
                    <ui:remove> wrap with container for caf async code </ui:remove>
                    <div id="#{caf:xh(htmlHead.resourceURI)}" class="page-portlet-container">
                        <caf_h:formattedMessages id="shellErrors"/>
 
                        <ui:remove> Include the template here </ui:remove>
                        <ui:include template="/form_template.xhtml"/>
 
                    </div>
                </div>
            </div>
        </div>
        <div id="footer">
            <ui:remove> shell foot </ui:remove>
            <mws_ui:resource renderer="shell">
                <f:attribute name="shell.subrenderer.layout.name" value="foot"/>
            </mws_ui:resource>
        </div>
    </div>
</h:body>
</html>
Copyright © 2016- 2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback