[jboss-user] [JBoss Seam] - a4j vs valuechangelistener

Sammy8306 do-not-reply at jboss.com
Thu Jun 21 04:36:06 EDT 2007


I started out with the following code:

  | <div class="input">
  |           <ui:repeat var="listvar" value="#{NewBlogEntryComponent.blogEntry_be.tags}">
  |               <h:outputText value="#{listvar} "/>   
  |               <h:commandButton value="Delete" action="#{NewBlogEntryComponent.remove(listvar)}"/>
  |               <br />
  |           </ui:repeat>
  |           <br />
  |           <s:decorate>
  |             <h:selectOneMenu id="tags1" value="#{dev.nulll}" onchange="submit()" valueChangeListener="#{NewBlogEntryComponent.listener}">
  |              <s:selectItems var="field" label="#{field.toString}" value="#{AllTag}" noSelectionLabel="Please select : " />
  |              <s:convertEntity/>
  |            </h:selectOneMenu>
  |         </s:decorate> 
  | </div>
  | 
This is part of a larger form, where I'm letting the user fill an entity. The depicted part is my stab at trying to input a list of references to other entities. In the valuechangelistener I retrieve the selected entity directly (thank you s:convertEntity!) and add it to the list. Works like charm, except that when the onchange event occurs, the complete form is submitted (and thus validated), whereas I'm only interested in updating the list. So, my next move was to use Ajax4Jsf (since I'm not willing to extract this part into its own separate form):


  | .. skipped ui:repeat part, is the same ..
  |  <s:decorate>
  |             <h:selectOneMenu id="tags1" value="#{dev.nulll}">
  |              <s:selectItems var="field" label="#{field.toString}" value="#{AllTag}" noSelectionLabel="Please select : " />
  |              <s:convertEntity/>
  |              <a:support event="onchange" reRender="relevantid" bypassUpdates="true" action="#{NewBlogEntryComponent.listener(field)}"/>
  |            </h:selectOneMenu>
  |   </s:decorate>
  | 

However, the parameter I'm receiving in listener() is always null. How can I access the selected value in the action method called by a:support? I guess field is not really in scope anymore for the a:support tag, but what are my options?

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

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



More information about the jboss-user mailing list