Task Forms
dmlloyd Nov 7, 2006 10:19 AMCurrently, the JSF Task Forms have a lot of requirements about the circumstances of their execution. For example, they assume that they are loaded from the /jbpm-console/participant/ path, so all their references are relative to there.
They also assume the existance of "taskBean", the presence of certain images in the "../images" path, and the presense of "../css/jbpm.css". And finally, they rely on structural details of the taskBean, such as action methods.
I propose that rather than having this information in the form (and thus putting significant restrictions on how the forms are displayed and used), each of those constructs could be replaced by a combination of a set of XML elements that perform each function, and using EL to import significant variables right into the task form space; for example, assuming an "tf" prefix for "task form":
<img src="../images/formline.jpg" width="100%" height="24" border="0" alt=""/>
Becomes:
<tf:formline/>
And:
<input jsfc="h:inputText" value="#{taskInstanceBean.variables['paymentId']}" />
Becomes:
<input jsfc="h:inputText" value="#{paymentId}"/>
And finally:
<input type="submit" jsfc="h:commandButton" id="transitionButton" action="#{taskInstanceBean.saveAndClose}" value="Save and Close Task"/> <input type="submit" jsfc="h:commandButton" action="#{taskInstanceBean.save}" value="Save"/> <input type="submit" jsfc="h:commandButton" action="#{taskInstanceBean.cancel}" value="Cancel"/>
Becomes:
<tf:transitionButtons/>...or can be left out altogether.
Also, the task form need not include <h:form> tags, since this is really implicit; by providing this ourselves, we can add any hidden inputs we need to, and this frees the form designer from worring about the implementation details of the web application that utilizes the forms.
Opinions?
Also, one other unrelated problem is that some of the example task forms have multiple elements with the same ID, which is not allowed by either JSF or HTML.