(2) jbpm websale code learning: Home. jsp (display task list)

Source: Internet
Author: User
Tags jbpm

// Call the gettaskinstances method of homebean to obtain a list. The name of each element in the list is Var = "taskinstance"

<H: datatable value = "# {homebean. taskinstances}" Var = "taskinstance" headerclass = "tableheader" columnclasses = "tablecell">

// H: column indicates a column, which is equivalent to TD in JSP
<H: column>

// F: facet indicates the list header.
<F: facet name = "Header">
<H: outputtext value = "task form link"/>
</F: facet>

// H: commandlink is equivalent to our common href. Action indicates the action to be executed after clicking
<H: commandlink action = "# {homebean. selecttaskinstance}">

// F: Param is the method for passing variables in JSF.
<F: Param name = "taskinstanceid" value = "# {taskinstance. ID}"/>

// H: outputtext indicates the name of the task to be displayed.
<H: outputtext value = "# {taskinstance. name}"/>
</H: commandlink>
</H: column>
<H: column>
<F: facet name = "Header">
<H: outputtext value = "process"/>
</F: facet>
<H: outputtext value = "# {taskinstance. taskmgmtinstance. taskmgmtdefinition. processdefinition. name}"/>
</H: column>
<H: column>
<F: facet name = "Header">
<H: outputtext value = "version"/>
</F: facet>
<H: outputtext value = "# {taskinstance. taskmgmtinstance. taskmgmtdefinition. processdefinition. Version}"/>
</H: column>
</H: datatable>

The above JSF code shows the list of tasks of the users currently entering the system. Click a Task Name and run the following code:

Homebean. Java:

 

Public String selecttaskinstance (){
// Get the task instance id from Request Parameter
Long taskinstanceid = jsfhelper. GETID ("taskinstanceid ");
Taskinstance = taskmgmtsession. loadtaskinstance (taskinstanceid );
Taskbean. initialize (taskinstance );
Return "task ";
}

Here, the method for obtaining parameter from the request is as follows:

Public static long GETID (string parametername ){
Long value =-1;
String valuetext = (string) facescontext. getcurrentinstance (). getexternalcontext (). getrequestparametermap (). Get (parametername );
Try {
Long id = new long (valuetext );
Value = ID. longvalue ();
} Catch (numberformatexception e ){
Throw new runtimeexception ("couldn't parse '" + parametername + "' = '" + valuetext + "' as a long ");
}
Return value;
}

Jbpm encapsulates parameter reading in its own way to simplify and develop quickly.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.