todo example: Starting a simple task failed
coolex Jun 30, 2008 4:31 PMHello!
I've tried to rebuild the todo example .
It is working fine so far except the done
button. There is problem with the posting of the taskInstance
attribute to start and stop a task.
Here is my todox.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" template="layout/template.xhtml"> <head> <title>Todo List</title> </head> <body> <h1>Todo List</h1> <f:view> <h:form id="list"> <div> <h:outputText value="There are no todo items." rendered="#{empty taskInstanceList}"/> <h:outputText value="#{task}"/> <h:dataTable value="#{taskInstanceList}" var="task" rendered="#{not empty taskInstanceList}"> <h:column> <f:facet name="header"> <h:outputText value="Description"/> </f:facet> <h:inputText value="#{task.description}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Task Instance ID"/> </f:facet> <h:inputText value="#{task.id}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Created"/> </f:facet> <h:outputText value="#{task.taskMgmtInstance.processInstance.start}"> <f:convertDateTime type="date"/> </h:outputText> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Priority"/> </f:facet> <h:inputText value="#{task.priority}" style="width: 30"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Due Date"/> </f:facet> <h:inputText value="#{task.dueDate}" style="width: 100"> <f:convertDateTime type="date" dateStyle="short"/> </h:inputText> </h:column> <h:column> <h:commandButton value="Done" action="#{todoList.done}" taskInstance="#{task.id}"/> </h:column> </h:dataTable> </div> <div> <h:messages/> </div> <div> <h:commandButton value="Update Items" action="update"/> </div> </h:form> <h:form id="new"> <div> <h:inputText value="#{todoList.description}"/> <h:commandButton value="Create New Item" action="#{todoList.createTodo}"/> </div> </h:form> </f:view> </body> </html>
Especially this part causes problems:
<h:commandButton value="Done" action="#{todoList.done}" taskInstance="#{task.id}"/>
And this is my TodoList.java class:
@Name("todoList") public class TodoList { private String description; public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @CreateProcess(definition = "todo") public void createTodo() { } @StartTask @EndTask public void done() { } }
I get this error:
Caused by javax.servlet.ServletException with message: "#{todoList.done}: java.lang.IllegalStateException: task/process id may not be null
I don't understand this because I know that the taskInstance id is not null. I made some simple printouts to see the task ids.
Please give me a hint.
Thx.