Calling EL with parameter is sometimes null
serkan.s.eskici.online.nl Dec 24, 2009 11:31 AMHi.
I've a weird problem with calling EL with parameters from my xhtml page.
The situation is as follows:
- I have a master page in which a complex html table gets rendered by making use of 3 nested
c:foreach
loops. - In one of the loops I render a link which calls an action and then redirects to the detail page. I pass an object as a parameter in the action.
- In the detail page I load an entity with its details and with a logo (lob).
- The whole stuff is inside a LRC (long running conversation).
Well, the point is that everything works fine, until I add/upload a logo to the entity. After I do that, the detail page is shown and the current conversation gets destroyed (automatically). And when I go back to the master page and click the link again, I get a NPE because the parameter in the EL also gets null (I think because the LRC gets ended).
But this doesn't happen when I don't add a logo the Entity Bean (see below).
So here's my code:
@Entity public class Contact implements Serializable { @Id @GeneratedValue @Column(nullable = false) private Long id; @Lob @Column() private byte[] logo; }
@Name("itemBean") @Scope(CONVERSATION) public class ItemBean { @In private ItemService service; @Out private List<ItemVO> items; @Begin(join=true) @Observer("some.event.happened") public void init(){ this.items = this.service.getItems(); } } @Name("contactBean") @Scope(CONVERSATION) public class ContactBean { @In private ContactService contactService; @Out private Contact selectedContact; public void getContact(DetailVO detail){ this.selectedContact = this.contactService.getContact(detail.name, detail.address); } }
master.xhtml: <h:form> <c:forEach items="#{items}" var="item> <h:panelGrid columns="4" rowClasses="odd,even" columnClasses=",right-aligned, ,last right-aligned"> <f:facet name="header"> <h:panelGroup> ... </h:panelGroup> </f:facet> <c:forEach items="#{item.types}" var="type"> <c:forEach items="#{type.details}" var="detail" varStatus="status"> <h:commandLink action="#{contactBean.getContact(detail)}" value="#{detail.name}" /> ----> this redirects to detail.xhtml <h:commandLink action="#{contactBean.getContact(detail)}" value="#{detail.name}"> ----> I also tried this one. <s:conversationId/> <s:concersationPropagation type='join' /> </h:commandLink> </c:forEach> </c:forEach> </h:panelGrid> </c:forEach> <h:/form> detail.xhtml: ... <h:inputText value="#{selectedContact.name}" /> <s:graphicImage value="#{selectedContact.logo}" alt="logo" rendered="#{not empty selectedContact.logo}"> <s:transformImageSize height="80" maintainRatio="true" /> </s:graphicImage> ... and so on
I use Seam 2.1.2 with JBoss AS 4.2.3.
Any help is welcome.
Cheers,
Serkan