WebSphere Portal Server - Use of person tag in JSF

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Portal Server > December 2005 > Use of person tag in JSF





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Use of person tag in JSF

2005-12-22, 5:59 pm

Hi,
I have a question regarding JSF compatibility with the person tag for people awareness.
First of all, it looks like I cannot access the JSF backing bean using #{bean.anygetter} from the person tag. Do I have to maybe define the backing bean as session scope to be able to access it or is this not possible at all.
Second, I want to use the person tag inside a jsf datatable, but instead of displaying the HTML and Java Script Code for each row, it displays it once before the datatable. I guess that again has something to do with the issue, when the datatable is rende
red. Is there a way to use person tags inside a JSF datatable?

Any help is highly appreciated!
Many thanks!
Luis

2005-12-22, 5:59 pm

I am using the people awareness tag inside a dataTable. In my case the pa:person
tag is rendered on each row. The bean that the table uses is a List object and it
is not in session scope. The dataTable has the parameters:

value="#{pc_LocatorView_PA.statusList}" var="varstatusList"

and the pa:person tag uses the variable like this

value="#{varstatusList.name}"

The pc_LocatorView_PA class is a faces managed request scope bean.


2005-12-23, 7:51 am

Hi Ben,
well, I thought it should work this way. However in my case it doesn't.
What JSF version are you using? I'm using 1.0, maybe its because of that.

Could you post a larger code excerpt, so I can compare it to mine.
I cannot get it to work properly.

Thanks

regards
Luis

2005-12-23, 5:57 pm

I'm not sure what JSF version. It's what came with RAD 6.0.1. Here is my entire
jsp. I'm not sure what this forum will do to the tags, but here goes...


-------------------------------------------------------------------------------
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
<%@taglib uri="http://www.ibm.com/jsf/portlet_person" prefix="pa"%>
<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="false"%>
<portlet:defineObjects />
<LINK rel="stylesheet" type="text/css"
href='<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/theme/stylesheet.css") %>'
title="Style">
<f:view>

<hx:scriptCollector id="scriptCollector1">
<h:dataTable id="table1" value="#{pc_LocatorView_PA.statusList}"
var="varstatusList" styleClass="dataTable" headerClass="headerClass"
footerClass="footerClass" rowClasses="rowClass1"
columnClasses="columnClass1" border="0" cellpadding="2"
cellspacing="0">
<h:column id="column1">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Name" id="text1"></h:outputText>
</f:facet>
<pa:person value="#{varstatusList.name}" ></pa:person>
</h:column>
<h:column id="column2">
<f:facet name="header">
<h:outputText styleClass="outputText" value="In/Out" id="text3"></h:outputText>
</f:facet>
<hx:graphicImageEx styleClass="graphicImageEx" id="imageEx1" value="images/green_dot.gif" rendered="#{varstatusList.isIn}" width="12" height="12"></hx:graphicImageEx>
<hx:graphicImageEx styleClass="graphicImageEx" id="imageEx3" value="images/spacer20x20.gif" width="12" height="12"></hx:graphicImageEx>
<hx:graphicImageEx styleClass="graphicImageEx" id="imageEx2" value="images/red_dot.gif" rendered="#{varstatusList.isOut}" width="12" height="12"></hx:graphicImageEx>
<hx:graphicImageEx styleClass="graphicImageEx" id="imageEx4" value="images/yellow_dot.gif" rendered="#{varstatusList.isUnknown}" width="12" height="12"></hx:graphicImageEx>
</h:column>
<h:column id="column4">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Location" id="text7"></h:outputText>
</f:facet>
<h:outputText id="text8" value="#{varstatusList.location}"
styleClass="outputText">
</h:outputText>
<f:attribute value="true" name="nowrap" />
</h:column>
</h:dataTable>
<h:form styleClass="form" id="form1">
<h:commandLink styleClass="commandLink" id="link1" action="#{pc_LocatorView_PA.doLink1Action}">
<h:outputText id="text9" styleClass="outputText" value="Refresh"></h:outputText>
</h:commandLink>
</h:form>
</hx:scriptCollector>
</f:view>


2005-12-23, 5:57 pm

Just as I thought. The forum strips out anything that looks like html.
The dataTable has the following parameters:

hx:dataTable id="table1" value="#{pc_LocatorView_PA.statusList}" var="varstatusList" styleClass="dataTable" headerClass="headerClass" footerClass="footerClass" rowClasses="rowClass1" columnClasses="columnClass1" border="0" cellpadding="2" cellspacing="0"


The column that has the person tag looks like this without the brackets:

h:column id="column1"
f:facet name="header"
h:outputText styleClass="outputText" value="Name" id="text1" /h:outputText
/f:facet

pa:person value="#{varstatusList.name}" /pa:person
h:column

That's pretty much it. The List gets populated on each request but I suppose
it should work as a session object also.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com