 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
mwmann Guest
|
Posted: Tue Dec 12, 2006 8:11 am Post subject: problem using 'instance of' in JSF tag for rendered attribut |
|
|
Hi
I am having a problem using the JSF dataGrid component.
Basically I am using the dataGrid to display a list of tasks. The
problem is that the list contains different types of classes of tasks,
some containing more information (attributes) than others.
EG: a BasicTask contains title, id and owner, HOWEVER a MileStoneTask
which extends BasicTask contains a dueDate attribute.
The requirements for the JSF datagrid is to display the dueDate field
if the row/task is a MileStoneTask, else don't display.
This is my DataGrid source:
==============================
<h:dataTable value="#{taskListHandler.sortedTasksModel}"
var="task"
style="text-align: left; width: 100%;" border="0"
cellpadding="2" cellspacing="2"
rows="#{taskListHandler.noOfRows}"
first="#{taskListHandler.firstRowIndex}" >
<h:column>
<f:facet name="header">
<h:commandLink action="#{taskListHandler.sortById}"
immediate="true">
<h:outputText value="Id"/>
</h:commandLink>
</f:facet>
<h:outputText value="#{task.id}" styleClass="standardText"/>
</h:column>
<h:column>
<f:facet name="header">
<h:commandLink action="#{taskListHandler.sortByTitle}"
immediate="true">
<h:outputText value="Title"/>
</h:commandLink>
</f:facet>
<h:commandLink action="#{taskService.select}" immediate="true">
<f:param name="taskId" value="#{task.id}" />
<f:param name="taskType" value="#{task.type}" />
<h:outputText value="#{task.title}"
styleClass="standardText"/>
</h:commandLink>
</h:column>
<!-- DUE DATE -->
<h:column>
<f:facet name="header">
<h:commandLink action="#{taskListHandler.sortByDue}"
immediate="true">
<h:outputText value="Due Date"/>
</h:commandLink>
</f:facet>
********* <h:outputText rendered="#{task instance of
com.face.domain.task.MileStoneTask}" value="#{task.dueDate.date}"
styleClass="standardText"/>
</h:column>
</h:dataTable>
==========================================
What I am trying to do is marked with **********
This is the error I am getting:
javax.servlet.ServletException: javax.servlet.jsp.JspException: task
instance of com.face.domain.task.MileStoneTask
Does anyone have any suggestion or pointers for me, as this is holding
up my development.
Thanks |
|
| Back to top |
|
 |
hiwa Guest
|
Posted: Tue Dec 12, 2006 3:34 pm Post subject: Re: problem using 'instance of' in JSF tag for rendered attr |
|
|
mwmann wrote:
| Quote: | Hi
I am having a problem using the JSF dataGrid component.
Basically I am using the dataGrid to display a list of tasks. The
problem is that the list contains different types of classes of tasks,
some containing more information (attributes) than others.
EG: a BasicTask contains title, id and owner, HOWEVER a MileStoneTask
which extends BasicTask contains a dueDate attribute.
The requirements for the JSF datagrid is to display the dueDate field
if the row/task is a MileStoneTask, else don't display.
This is my DataGrid source:
==============================
h:dataTable value="#{taskListHandler.sortedTasksModel}"
var="task"
style="text-align: left; width: 100%;" border="0"
cellpadding="2" cellspacing="2"
rows="#{taskListHandler.noOfRows}"
first="#{taskListHandler.firstRowIndex}"
h:column
f:facet name="header"
h:commandLink action="#{taskListHandler.sortById}"
immediate="true"
h:outputText value="Id"/
/h:commandLink
/f:facet
h:outputText value="#{task.id}" styleClass="standardText"/
/h:column
h:column
f:facet name="header"
h:commandLink action="#{taskListHandler.sortByTitle}"
immediate="true"
h:outputText value="Title"/
/h:commandLink
/f:facet
h:commandLink action="#{taskService.select}" immediate="true"
f:param name="taskId" value="#{task.id}" /
f:param name="taskType" value="#{task.type}" /
h:outputText value="#{task.title}"
styleClass="standardText"/
/h:commandLink
/h:column
!-- DUE DATE --
h:column
f:facet name="header"
h:commandLink action="#{taskListHandler.sortByDue}"
immediate="true"
h:outputText value="Due Date"/
/h:commandLink
/f:facet
********* <h:outputText rendered="#{task instance of
com.face.domain.task.MileStoneTask}" value="#{task.dueDate.date}"
styleClass="standardText"/
/h:column
/h:dataTable
==========================================
What I am trying to do is marked with **********
This is the error I am getting:
javax.servlet.ServletException: javax.servlet.jsp.JspException: task
instance of com.face.domain.task.MileStoneTask
Does anyone have any suggestion or pointers for me, as this is holding
up my development.
Thanks
It should be a bean property that has getter and setter methods. |
You can't write Java expression here. You could use EL operators
including 'empty', etc., though.
| Quote: | #{task instance of com.face.domain.task.MileStoneTask}
#{task.mileStone} |
public boolean isMileStone(){
return task instance of com.face.domain.task.MileStoneTask;
} |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|