Create the HTML form
Use WCM design components to generate the HTML forms for the user interfaces that provide the user interactions.
To generate the HTML form markup using IBM Digital Data Connector design components:
- Set the form method attribute to the value: post
- Set the form enctype attribute to the value: multipart/form-data
- Set the form action attribute to a portlet action URL that addresses the web content viewer, and triggers its post portlet action.
- Add a hidden input field with the name _charset_ as the first input field to the form.
This input field defines the character set the browser uses to encode the form data. Initialize it with the character encoding of the page.
<input type="hidden" name="_charset_" value="[Plugin:EvaluateEL value="${pageContext.response.characterEncoding}" compute="once"]"/>
- To specify the target URI for the interaction, use a second hidden input field named action.uri. The target URI identifies the actual recipient of the data that is posted by this form, which must be a data sink. To do so, use the following HTML code:
<input type="hidden" name="action.uri" value="..."/>
- Add more hidden or visible form input fields to the form. Use these input fields to assemble all the information that is necessary for the recipient of this form post, that is the data sink specified with the action.uri parameter to perform the specified operation. Example: To trigger the creation of a forum topic reply:
- Define text input fields for gathering the title and body information from the user.
- Add further hidden input fields for identifying the target forum topic. These input fields are typically filled using a corresponding [AttributeResource] tags.
Results
The target URI needs to identify a data sink that accepts multipart data requests. Use data sinks of the following types:
- Use a data sink that IBM WebSphere Portal provides
- Use a custom implementation of the com.ibm.portal.resolver.data.FormDataDataSink interface. This interface is defined in the public POC resolution framework API. For more detailed information, refer to the Package com.ibm.portal.resolver.data summary.
Here is an example of an HTML form for sending data to the Web Content Viewer portlet:
<form method="post" enctype="multipart/form-data" action="[Plugin:ActionURL action="post" copyCurrentParams="true" param="resultSessionAttribute=myResult" compute="always"]"> <input type="hidden" name="_charset_" value="[Plugin:EvaluateEL value="${pageContext.response.characterEncoding}" compute="once"]"/> <input type="hidden" name="action.uri" value="$DATA_SINK_URI"/> <input type="hidden" name="myAction" value="createComment"/> <input type="hidden" name="myResourceId" value="[AttributeResource attributename="id"]"/> My Text: <input type="text" name="myTextField"/><br/> <input type="submit" value="Submit"/> </form>Replace the variable $DATA_SINK_URI by the appropriate value for the environment.
Parent Send data to the Web Content Viewer portlet
Related information
Package com.ibm.portal.resolver.data summary