-
1. Re: JSF EL - Cant Pass parameters
kukeltje Aug 21, 2006 7:08 PM (in response to falazar)James,
This is JSF stuff and hs nothing to do with jBPM. If it is possible in jsf it is possible here.
Datatables have some knowledge on the record you are working on, so these might help (where did I read this message before and responded the same... I have a deja-vu I think)
Maybe you could make a hashmap and retrieve it based on the key (which can be the processid. This means that you have to extend the participantbean. -
2. Re: JSF EL - Cant Pass parameters
tom.baeyens Aug 22, 2006 4:43 AM (in response to falazar)afaik, passing parameters in jsf expressions is not yet supported.
-
3. Re: JSF EL - Cant Pass parameters
falazar Aug 22, 2006 9:39 AM (in response to falazar)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 -
4. Re: JSF EL - Cant Pass parameters
falazar Aug 22, 2006 9:47 AM (in response to falazar)The helpful post was here:
http://forum.java.sun.com/thread.jspa?threadID=756732&tstart=165
James -
5. Re: JSF EL - Cant Pass parameters
tom.baeyens Aug 22, 2006 10:33 AM (in response to falazar)then the trick with the wrapper bean seems much more elegant to me.