ShowTable of Contents
Get HTTP Post data you received from another source
If your xpages is called in another form's action, and that form transfers it's data as HTTP post data, you can read that data as follows:
Or if you already know what value you would like to read, use this:
param.get( 'parameterName' )
You can archieve the same with the following code:
var request:com.sun.faces.context.MyHttpServletRequestWrapper = facesContext.getExternalContext().getRequest();
Thanks to Tommy Valand for telling me about the build-in param map.
Convert HTTP Post data from one charset to another
A java servlet always interprests the data of an http request in ISO-8859-1 charset, and so does the XPage engine, too.
If the sender sends the data in UTF-8 or any other charset, you can convert it with:
var data = param.toString();
data = new java.lang.String(data.getBytes("ISO-8859-1"), "UTF-8");
Embed a custom HTML form in a XPage
Per default, each XPage is rendered with a <form> tag.
You can disable that in the "All properties" section of the XPage -> basics -> create form = false. But then a lot of XPages functionality will not work.
But you can use the XPage default form and your own HTML forms side by side using the <xp:form> tag.
Just use the <xp:form> tag somewhere in your XPage where you use XPage functionality (buttons, partial updates etc.). Then close that tag and write your own HTML form tag.
... standard XPage code ...
...some XPage code, for example a button running a partial update...
<form action="http://some.url..." method="post">
<input type="hidden" name="example" value="somevalue"/>
... other HTML form stuff ...