Portlet Factory, Version 6.1.2


 

Restrictions on models used as portlets

Most models run fine both as standalone web applications and as portlets. The following are restrictions on models that you intend to use as portlets:

Use the POST method

Use method="POST" in your input <form> tags in your HTML pages rather than method="GET" or unspecified which defaults to GET.

Accessing input data

The JSR 168 Portlet request life cycle processes Action requests separately from Render requests in order to allow portlets on a page to be rendered multiple times per explicit portlet action. Due to behavior you cannot rely on request parameters being available in the page rendering stage. For example, do not use ${Inputs/inputname} as an indirect reference for Page Control builders (Text builder, and so on). Instead, save necessary inputs to Variables or application state data and reference them in page controls from that saved state instead.For example, the sample code below accesses the RequestInput data from a webApp instance, and saves the results into the XML variable named formdata.
{   Iterator itr = webAppAccess.getRequestInputs().getInputNames();  IXml formData = webAppAccess.getVariables().getXml("formdata");  formData.removeChildren(); //clear old form data out of variable.  String inputName = new String();   while (itr.hasNext()) {    inputname = (String)itr.next();    formData.addChildWithText(inputname, webAppAccess.getRequestInputs().getInputValue(inputname));   } }

Parent topic: Introduction to portlets


Library | Support |