i'm trying to get a plain commandLink to work. Here is a code snippet of the page:
<div class="item-single">
<h:graphicImage value="image/screenshots/#{collectionListBean.collectionListTeaser[0].screenshot}" alt="Screenshot #{collectionListBean.collectionListTeaser[0].title}"/>
<div class="item-title">
<h:form id="teaser0">
<h:commandLink value="#{collectionListBean.collectionListTeaser[0].title}" action="#{collectionBean.showCollection(collectionListBean.collectionListTeaser[0].id)}" />
</h:form>
</div>
<div class="item-description">
<p>
<h:outputText value="#{collectionListBean.collectionListTeaser[0].persons.get(0).person.getFullName()}" />
</p>
</div>
</div>
The title is displayed correctly, so the backing bean and the list is available and accessible. CollectionBean is also available and accessible. The list has a fixed size and is used inside a javascript gallery which is the reason why i didn't use ui:repeat or h/p:dataTable elements.
I have also checked BalusC'S List of common problems
The action is not being invoked in the backing bean, I get following javascript error on the browser console:
Uncaught TypeError: Cannot read property 'teaser0:_idcl' of undefined
Here is the relevant code of the backing bean (collectionBean):
@Named("collectionBean")
@Scope("access")
@ViewController(viewIds = {ViewIds.EDIT_COLLECTION, ViewIds.SHOW_COLLECTION, ViewIds.EDIT_COLLECTION, ViewIds.METADATA_COLLECTION_ADMIN, ViewIds.EDIT_COLLECTION_EXISTING, ViewIds.COLLECTION_LIST, ViewIds.HOME})
public class CollectionBean extends CollectionBeanBase {
.
.
.
public String showCollection(long id) {
//Check if user is admin, if yes, allow to edit metadata
Authentication auth=SecurityContextHolder.getContext().getAuthentication();
this.collection = collectionService.findById(id);
if (!(auth instanceof AnonymousAuthenticationToken)){
role=auth.getAuthorities().iterator().next().getAuthority();
if(role.equalsIgnoreCase("ROLE_ADMIN")) {
this.collection.setEdit_flag(true);
return ViewIds.EDIT_COLLECTION;
}
}
return ViewIds.SHOW_COLLECTION;
}
Does anyone have an idea what the problem might be? Any hint is highly appreciated! thank you guys in advance!