[jboss-user] [JBoss Seam] - Re: Rendering buttons in a datatable fails

hubaer do-not-reply at jboss.com
Tue Mar 13 09:47:41 EDT 2007


Thank you so far.

Ok, here some code snippets.

The xhtml is similar as in the first post. I put only the rendered attribute on the commandButton:
<h:form>
  |     <h:dataTable var="entry" value="#{entryList}" rendered="#{entryList.rowCount>0}">
  |      <h:column>
  |            <f:facet name="header">
  |                 <h:outputText value="Title"/>
  |            </f:facet>
  |            <h:outputText value="#{entry.title}"/>
  |      </h:column>
  |      <h:column>
  |            <f:facet name="header">
  |                  <h:outputText value="Status"/>
  |            </f:facet>
  |            <h:outputText value="#{entry.status}"/>
  |      </h:column>
  |      <h:column>
  |             <h:commandButton value="Edit" action="#{entryAction.edit(entry)}" rendered="#{entryAction.editable}"/>
  |       </h:column>
  |       </h:dataTable>
  |    </h:form>
  | 


Here is some code from the corresponding action bean:

@Stateful
  | @Name("entryAction")
  | @Scope(ScopeType.CONVERSATION)
  | 
  | public class EntryActionBean implements EntryAction, Serializable {
  |     
  |     private Logger log = Logger.getLogger(EntryActionBean.class);
  | 
  |     @DataModel
  |     private Set<Entry> entryList;
  |     
  |     @DataModelSelection
  |     private Entry entry;
  |     
  |     @Factory("entryList")
  |     public void initEntryList() {
  |         log.info("initEntryList");
  |         entryList = getEntryList();
  |     }
  |     
  |     public boolean isEditable() {
  |         return checkEditable(entry);
  |     }
  |     
  |     public String edit(Entry entry) {
  |         log.info("edit Entry " + entry);
  |         return "editEntry";
  |     }
  |     
  |     @Remove @Destroy
  |     public void destroy() {
  |         log.info("Called @Remove/@Destroy");
  |     }
  |     
  |     ...
  | }
  | 

I also tried out the s:button, but there is no parameter passing to the action bean. I get always a null value.

Hope that helps.

Marco 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027543#4027543

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027543



More information about the jboss-user mailing list