The view/singleTask page (for example view/singleTask?taskId=2) is built in a similar way than the tasksList page, without requiring new definitions in the sitemap.
Shown below are the singleTask-specific portions of our code. Refer to the taskList page for the corresponding sitemap excerpts.
These methods query the java objects and call the appropriate pipeline for display:
0020 // Query a single TaskBean object and display it 0021 function query_singleTask() { 0022 id = cocoon.request.getParameter("taskId"); 0023 bean = db.getTaskBeanById(id); 0024 displayTaskBean(id,bean); 0025 } ... 0038 // Display a single TaskBean 0039 function displayTaskBean(id,bean) { 0040 cocoon.sendPage("internal/generate-view/singleTask", { 0041 title : "Task #" + id, 0042 task : bean, 0043 selectedTaskId : id 0044 }); 0045 }
Note that no error checking is done, for example for a missing taskId parameter. This would obviously be needed in a production application.