[jboss-dev-forums] [Design of JBoss jBPM] - Re: JSF EL - Cant Pass parameters
falazar
do-not-reply at jboss.com
Tue Aug 22 09:39:07 EDT 2006
Hmm ok.
Well I found one way to do it that got it working, I can show every version of the processdefinitions, and how many instances there are in it.
What forum are we discussing web console issues? As I work on teh web app interface I would like to be able to show my findings and ask questions there.... I was looking through the faces mailing list as well.. but they didnt know offhand.
Solution:
The loop needs to be a ui:repeat instead of a forEach, and you must create a binding variable, that will set the variable for each spot in the loop, and you can access it in the bean.
| <ui:repeat var="processDefinition" value="#{participantBean.allProcessDefinitions}">
| <tr class="normal" onmouseover="this.className='hovered';" onmouseout="this.className='normal';" onclick="document.all['newExe#{processDefinition.id}\'].click()">
| <td class="selectable"><h:outputText value="#{processDefinition.name}" /> (<h:outputText value="#{processDefinition.id}" />) </td>
| <td class="selectable"><h:outputText value="#{processDefinition.version}" /></td>
|
| <td class="selectable">
| <h:outputText binding="#{participantBean.textElement}" value="">
| <f:attribute name="text" value="#{processDefinition.id}" />
| </h:outputText>
| <!-- The below function is called with the above parameter. -->
| <h:outputText value="#{participantBean.allProcessInstances}" />
| </td>
|
| <td class="selectable">
| <h:commandLink action="#{participantBean.startNewProcessInstance}" id="newExe#{processDefinition.id}">
| <f:param name="processDefinitionId" value="#{processDefinition.id}"/>
| Start It!
| </h:commandLink>
| </td>
| </tr>
| </ui:repeat>
import javax.faces.component.html.HtmlOutputText;
|
| private HtmlOutputText textElement;
|
| // Count all process instances for this definition
| public String getAllProcessInstances()
| {
| // This text value is defined in the binding in the home.xhtml file
| long PID = ((Long)getTextElement().getAttributes().get("text")).longValue();
| return Integer.toString(jbpmBean.getJbpmContext().getGraphSession().findProcessInstances(PID).size());
| }
|
| public HtmlOutputText getTextElement() {
| return textElement;
| }
|
| public void setTextElement(HtmlOutputText textElement) {
| this.textElement = textElement;
| }
The main part here is the getAllProcessInstances() method, which needs the processDefinition.id (PID) value to be passed in from the web form. With that we can return and display the number of instances there are for each processDefition version.
James
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966696#3966696
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966696
More information about the jboss-dev-forums
mailing list