AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

problem using 'instance of' in JSF tag for rendered attribut

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
mwmann
Guest





PostPosted: Tue Dec 12, 2006 8:11 am    Post subject: problem using 'instance of' in JSF tag for rendered attribut Reply with 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
Back to top
hiwa
Guest





PostPosted: Tue Dec 12, 2006 3:34 pm    Post subject: Re: problem using 'instance of' in JSF tag for rendered attr Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.