Displaying value against Id for single entity.
valatharv Dec 10, 2010 11:00 AMHi,
Please advice if there is any trick on how I can display value/ name against Id from single table/ entity when xhtml page loads in point b(i), b(ii).
Overview :
a) I have single entity Computers with fields as compId, computerName, applicationServerId
@Entity
@Name("Computers")
@Table(name = "COMPUTERS")
public class Computers implements java.io.Serializable {
private Long compId;
private String computerName;
private Long applicationServerId;
@Column(name = "COMP_ID")
public Long getCompId() {
return this.compId;
}
public void setCompId(Long compId) {
this.compId = compId;
}
@Id
@Column(name = "COMPUTER_NAME", unique = true, nullable = false, length = 50)
@NotNull
@Length(max = 50)
public String getComputerName() {
return this.computerName;
}
public void setComputerName(String computerName) {
this.computerName = computerName;
}
@Column(name = "APPLICATION_SERVER_ID")
public Long getApplicationServerId() {
return this.applicationServerId;
}
public void setApplicationServerId(Long applicationServerId) {
this.applicationServerId = applicationServerId;
}
}
b) Seam-gen generated nice home and view objects.
Here applicationServerId can be any compId.
i) In Computers.xhtml applicationServerId is mapped from
<s:decorate id="applicationServerId" template="layout/display.xhtml">
<ui:define name="label">Application Server</ui:define>
#{computersHome.instance.applicationServerId} // CAN THIS BE SOMEHOW MAPPED TO CORRESPONDING computerName
</s:decorate>
ii) In ComputersList.xhtml applicationServerId is displayed from wrkComputersList.resultList
<rich:dataTable id="computersList"
var="computers"
value="#{computersList.resultList}"
rendered="#{not empty computersList.resultList}">
<h:column>
<f:facet name="header">
<s:link styleClass="columnHeader"
value="Processing ServerId #{computersList.order=='applicationServerId asc' ? messages.down : ( computersList.order=='applicationServerId desc' ? messages.up : '' )}">
<f:param name="order" value="#{computersList.order=='applicationServerId asc' ? 'applicationServerId desc' : 'applicationServerId asc'}"/>
</s:link>
</f:facet>
#{computers.applicationServerId} // CAN THIS BE SOMEHOW MAPPED TO CORRESPONDING computerName
</h:column>
Please advice if there is any trick on how I can display value/ name against Id from single table/ entity when xhtml page loads in point b(i), b(ii).
Overview :
a) I have single entity Computers with fields as compId, computerName, applicationServerId
@Entity
@Name("Computers")
@Table(name = "COMPUTERS")
public class Computers implements java.io.Serializable {
private Long compId;
private String computerName;
private Long applicationServerId;
@Column(name = "COMP_ID")
public Long getCompId() {
return this.compId;
}
public void setCompId(Long compId) {
this.compId = compId;
}
@Id
@Column(name = "COMPUTER_NAME", unique = true, nullable = false, length = 50)
@NotNull
@Length(max = 50)
public String getComputerName() {
return this.computerName;
}
public void setComputerName(String computerName) {
this.computerName = computerName;
}
@Column(name = "APPLICATION_SERVER_ID")
public Long getApplicationServerId() {
return this.applicationServerId;
}
public void setApplicationServerId(Long applicationServerId) {
this.applicationServerId = applicationServerId;
}
}
b) Seam-gen generated nice home and view objects.
Here applicationServerId can be any compId.
i) In Computers.xhtml applicationServerId is mapped from
<s:decorate id="applicationServerId" template="layout/display.xhtml">
<ui:define name="label">Application Server</ui:define>
#{computersHome.instance.applicationServerId} // CAN THIS BE SOMEHOW MAPPED TO CORRESPONDING computerName
</s:decorate>
ii) In ComputersList.xhtml applicationServerId is displayed from wrkComputersList.resultList
<rich:dataTable id="computersList"
var="computers"
value="#{computersList.resultList}"
rendered="#{not empty computersList.resultList}">
<h:column>
<f:facet name="header">
<s:link styleClass="columnHeader"
value="Processing ServerId #{computersList.order=='applicationServerId asc' ? messages.down : ( computersList.order=='applicationServerId desc' ? messages.up : '' )}">
<f:param name="order" value="#{computersList.order=='applicationServerId asc' ? 'applicationServerId desc' : 'applicationServerId asc'}"/>
</s:link>
</f:facet>
#{computers.applicationServerId} // CAN THIS BE SOMEHOW MAPPED TO CORRESPONDING computerName
</h:column>