[JBoss Seam] - Strange problem using Seam iterating display components like
by mwkohout
I'm creating a page where a user selects elements to be added to a entity object from a rich datatable...simple enough.
That functionality works-when I look at the domain object through the debug.seam view, I see it's being updated.
But when I attempt to display/iterate over the list of elements in the domain object, I'm getting this error:
| javax.el.ELException: /home.xhtml: Property 'name' not found on type java.util.HashSet
|
here's my code:
| <h:inputText id="findMentor" value="#{newTeamFormMap.mentorName}">
| <a4j:support event="onkeyup" reRender="mentorSelectList" requestDelay="1000" ignoreDupResponces="true" eventsQueue="myQueue" />
| </h:inputText>
| <rich:spacer height="10"/>
| <rich:dataTable id="mentorSelectList" value="#{userHome.findByNameOrInternetID( newTeamFormMap.mentorName )}" var="user" render="#{not empty newTeamFormMap.mentorName}">
| <rich:column>
| <f:facet name="header">Name</f:facet>
| #{user.name}
| </rich:column>
| <rich:column>
| <f:facet name="header">Add to List of Project Mentors</f:facet>
| <a4j:commandButton type="submit" value="Add" reRender="selectedMentorList" action="#{newTeam.mentors.add(user)}" />
| </rich:column>
| </rich:dataTable>
| <rich:spacer height="10"/>
|
| <a4j:repeat id="selectedMentorList" value="#{newTeam.mentors}" var="selectedMentor" rendered="#{newTeam.mentors.size gt 0}" summary="Project Mentors">
| #{selectedMentor.name}
| </a4j:repeat>
|
The error is occurring at the bottom, at #{selectedMentor.name}
The userHome object is pretty generic-userHome.findByNameOrInternetID expects a String as a parameter and returns a Set, as is newTeam- the mentors property is a Set(HashSet) as well. Nothing is defined as a DataModel, but it seems that if that was the problem I wouldn't be able to see my entity object being updated via debug.seam.
does anyone see an error or what am I doing wrong? could this be a richfaces/a4j error rather than a seam error?
thanks
Mike Kohout
--also, if anyone was tracking my saga with SSO, I was able to get single sign on working for my site. Sometime soon I'll post all my steps...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4072087#4072087
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4072087
18Â years, 9Â months
[JBoss Seam] - @In annotation on attributes resolves to null
by FredF
Hello. I use seam 2.0 B1, jboss AS 4.2 and Facelets Sun RI.
I have a facelets jsf file called showmessages.xhtml, a stateless seam component called CellIdBean and an stateful seam component called MessagesActionBean.
My use case is simply to load messages from db in the MessagesActionBean and show them in the messages.xhtml. The special thing is that the xhtml will consist of several facelets includes that has their own id. (Therefor I cannot use the id with a page parameter in pages.xml). I want to pass the ids many times in the messages.xhtml to the MessagesActionBean by using the CellIdBean as a "DTO" and inject this CellIdBean in the action with @In.
This solution might sound unnecessarily complex but if I try just to set the cellId directly in the MessagesActionBean with
messagemanager.setCellId(cellid)
then I get a complaint in the method initMessages about the cellId being null when initMessages is executed (it has an @create annotation).
The setCellId is then not even run. I guess that the @create methods are run before the setters of the properties are run? Am i wrong?
Anyway, instead I tried this way (with the "DTO")
#{cellidbean.setCellId(cell.id)}
The cellidbean component is created and the cellid is set in the component CellIdBean (below).
@Stateless
| @Name("cellidbean")
| public class CellIdBean implements CellIdBeanLocal {
|
| @In(create = true)
| private Long cellId;
|
| public CellIdBean() {
| }
|
| public void setCellId(Long cellId) {
| this.cellId = cellId;
| }
|
| public Long getCellId() {
| return cellId;
| }
| }
But when I try to use this cellidbean in my actionclass MessagesActionBean it is resolved to null
@Name("messagemanager")
| @javax.ejb.Stateful
| public class MessageActionBean implements MessageActionLocal {
| @In(create = true) // <-- this resolves to null
| private CellIdBeanLocal cellIdBean;
|
|
| .
| .
| .
| constructors
| .
| .
| .
|
|
| @Override
| @Create
| protected void handleInitMessages() {
| // get messages for the requesting cell
| }
|
| }
Why is the injection of cellidbean in messageactionbean not done?
thank you
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4072086#4072086
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4072086
18Â years, 9Â months