SelectOneMenu and commandButtons

Hi Iam using J2EE 1.4 and jsf1.0. I have the following code
<h:selectOneMenu id="groups" value="#{UserBean.selectedGroup}">
<f:selectItems value="#{UserBean.groupsList}"/>
</h:selectOneMenu>
<h:commandButton id="showGroupMembers" value="Show Members" action="#{UserBean.showGroupMembers}"/>
<!-- backing bean -->
groupsList.add(new SelectItem(groupName,groupName)); // groupName is a String
public ArrayList getGroupsList()
FacesContext.getCurrentInstance().addMessage(null,new FacesMessage("dd"));
return groupsList;
public void setGroupsList(ArrayList list)
try
groupsList = list;
catch(Exception e)
FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(e.getMessage()));
public SelectItem getSelectedGroup()
return selectedGroup;
//return new SelectItem((String)selectItemsList.get(0),(String)selectItemsList.get(0));
public void setSelectedGroup(SelectItem group)
try
selectedGroup = group;
catch(Exception e)
FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(e.getMessage()));
When I press the command buttons I get a message saying conversion error occured.But Iam not sure
either it is the conversion for selectedGroup or the ArrrayList . From other threads about this topic I learned that Strings should be ok to use with selectItem. Where am I going wrong.
thanx all for ur help
phani

Hi sorry .
I was blindly following some example I found on the net. The selectedGroup must be String . Then everything works
sorry for the trouble
phani

Similar Messages

  • Question regarding selectOneMenu and PROCESS_VALIDATIONS(3) phase

    Hi im a bit lost regarding selectOneMenu and how validation phase all works together.
    The thing is that i have a simple selectOneMenu
    <h:form id="SearchForm">                                                  
         <h:panelGrid columns="3"  border="0">
              <h:outputLabel id="caseTypeText" value="#{msg.searchCaseCaseType}" for="caseType" />                         
              <h:selectOneMenu id="caseType" value="#{searchCaseBean.caseType}" style="width: 200px;" binding="#{searchCaseBean.caseTypeSelect}">     
                   <f:selectItem itemValue="" itemLabel="#{msg.CommonTextAll}" />                                             
                   <f:selectItems value="#{searchCaseBean.caseTypes}"  />                              
              </h:selectOneMenu>
              <h:message for="caseType" styleClass="errorMessage" />
              <h:panelGroup />
              <h:panelGroup />
              <h:commandButton action="#{searchCaseBean.actionSearch}" value="#{msg.buttonSearch}" />
         </h:panelGrid>
    </h:form>Now when i hit submit button i can see that the bean method searchCaseBean.caseTypes (used in the <f:selectItems> tag) is executed in the PROCESS_VALIDATIONS(3) phase. How come? I dont whant this method to be executed in phase 3, only in phase 6.
    If i add the this in the method if (FacesContext.getCurrentInstance().getRenderResponse())
    public List<SelectItem> getStepStatuses(){
         List<CaseStep> caseSteps = new ArrayList<CaseStep>();
         if (FacesContext.getCurrentInstance().getRenderResponse()) {
              caseSteps = getCaseService().getCaseStep(value);     
         List<SelectItem> selectItems = new ArrayList<SelectItem>(caseSteps.size());
         for(int i=0; i < caseSteps.size(); i++){
              CaseStep step = caseSteps.get(i);               
              String stepStatus = step.getStatus() + "_" + step.getSubStatus();           
              selectItems.add(new SelectItem(stepStatus, step.getShortName()));
         return selectItems;
    } Now i get a validation error (javax.faces.component.UISelectOne.INVALID) for the select field and only phase1, phase2, phase 3 and phase 6 is executed.
    Im lost?

    I see. Many thanxs BalusC. Im using your blog very often, and its very helpfull for me.
    I changed now to use the constructor load method instead. But know im getting problem of calling my service layer (Spring service bean). Its seems they havent been init when jsf bean is calling its constructor.
    Can i init the spring service bean from the faces-config file?
    JSF Bean
        public SearchCaseBean() {
              super();
                    //caseService need to be init
              if(getCaseService() == null){
                   setCaseService((CaseService)getWebApplicationContextBean("caseService"));
              fillCaseTypeSelectItems();
              fillCaseStatusSelectItems();
    .....faces-config
    <managed-bean>
              <managed-bean-name>searchCaseBean</managed-bean-name>
              <managed-bean-class>portal.web.SearchCaseBean</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>          
              <managed-property>
                   <property-name>caseService</property-name>
                   <value>#{caseService}</value>
              </managed-property>
         </managed-bean>

  • The scenario is:  I have a page consisting of SelectOneMenu and different t

    The scenario is:
    I have a page consisting of SelectOneMenu and different text fields. Based on the values selected from the select one menu,
    some of the text fields need to be made mandatory.
    Using onchange = "submit()" will validate other fields also, which I do not want to do at this time.
    Hence I have used code as shown below which invokes a command button(that has immediate=true so that validation will
    not be performed for other fields) when values are changed . In the value changed event method , I set the rendered property
    of the mandatory text field.
    <h:selectOneMenu id="source" value="#{companyPaymentRemark.prVO.sourceID}" 
        onchange="buttonClick('layout:content:hiddenSubmit')" valueChangeListener="#{companyPaymentRemark.sourceValueChange}"> 
                <f:selectItems value="#{companyPaymentRemark.sourceList}" /> 
         </h:selectOneMenu> 
        <h:commandButton id="hiddenSubmit" immediate="true" action="" style="display:none"/> 
    <h:selectOneMenu id="source" value="#{companyPaymentRemark.prVO.sourceID}" onchange="buttonClick('layout:content:hiddenSubmit')" valueChangeListener="#{companyPaymentRemark.sourceValueChange}"> <f:selectItems value="#{companyPaymentRemark.sourceList}" /> </h:selectOneMenu> <h:commandButton id="hiddenSubmit" immediate="true" action="" style="display:none"/>The problem is that the value changed listener is never getting invoked
    My thinking is that using immediate=true will only skip Convertion ,Validation and update model phase and the listener should be called as is.
    Regards,
    Joshua

    This article may be helpful then: [http://balusc.blogspot.com/2007/10/populate-child-menus.html].

  • Problem with commandLink and commandButton

    Problem with commandLink and commandButton
    I have commandButton id="submit" action="{myActionClass.dothis}"
    When I click on the commandbutton it is not submiting to the action class rather, its submitting to the same page..
    I am tired of this ...
    I am using tiles for displaying jsf pages . Any problem because of using tiles

    yes I have the validator.
    If I open the url directly its working fine
    let say I am opening localhost:8080/test/test.jsf
    then it works fine
    If i use the same test.jsf along with tiles and open it, then its dispalying all the elements but when i click on commandbutton.. nothin is happening.
    the seems like page is reloaded.

  • H:selectOneMenu and converter problem

    Hello
    I'm working on an application (Address Database) using JSF (Base JSF libs with IBM Faces). Apache Tomcat Server 5.5.
    Since days i'm trying to solve my problem with h:selectOneMenu and converter. I can save values correctly, but i cannot display the saved value again as a selected item.
    so here is my jsf code section:
         <h:selectOneMenu value="#{personBean.person.representative}"
                        styleClass="fldDefault fldcombo">
                        <f:selectItems value="#{partnerBean.representatives}" />
                        <f:converter converterId="keywordConvertor" />
                        <f:attribute name="SelectItemArrayList"
                             value="#{partnerBean.representatives}" />
         </h:selectOneMenu>
    representatives are keywords and in the selectOneMenu, a representative keyword object is stored.
    here is my partnerBean.jsp Code:
         private List<SelectItem> representatives = null;
         * populate keywords of type REPRESENTATIVE
         public void populateRepresentatives() {
              representatives = new ArrayList<SelectItem>();
              ArrayList<Keyword> representativeKeywords = kwHandler
                        .getKeywordsByType(KW_REPRESENTATIVE_TYPE);
              for (Keyword keyword : representativeKeywords) {
                   representatives.add(new SelectItem(keyword, keyword
                             .getKwDescription()));
    so the function gets the representative keyword objects, loop through them and add a newly created SelectItem Object to the representatives list.
    There is a converter in order to save and display (should!!) the values:
    public class KeywordConvertor implements Converter {
         public Object getAsObject(FacesContext context, UIComponent component,
                   String value) {
    ....code for saving...
         public String getAsString(FacesContext context, UIComponent component,
                   Object obj) {
    `          System.out.println(((Keyword) obj).getId()+"");
              return ((Keyword) obj).getId()+"";
    i did not provide the code for getAsObject, since the saving of the combo box works fine. If it has to do something with my problem, please ask me for this code..
    The System.out.prinln prints all ids correctly, but the generated HTML Code does not select the given value in the combobox.
    So whats wrong with the getAsString Method? or is the function completely somewhere else?
    I have to say that the function ((Keyword) obj).getId() returns a long !! is that the problem?
    Any help is very appreciated

    Hello
    i implemented the function in the Keyword Class:
    public class Keyword implements Serializable {
         public boolean equals(Keyword kw) {
              System.out.println("calling equals in:" + kw.getId());
              if (kw.getId() == this.getId()) {
                   return true;
              } else {
                   return false;
    but the System.out.print is not executed...
    i tried also:
         public boolean equals(Object o) {
              Keyword kw = (Keyword) o;
              System.out.println("calling equals in:" + kw.getId());
              if (kw.getId() == this.getId()) {
                   return true;
              } else {
                   return false;
    but then i get the following error message:
    org.apache.jasper.JasperException: javax.servlet.jsp.JspException: could not initialize proxy - no Session
    hmmm, could you show me how to implement the equals Function correctly?

  • Browser compatibility problem with t:selectOneMenu and JavaScript calendar

    I'm having problem with <t:selectOneMenu> and JavaScript calendar on IE. It works fine on Firefox but doesn't work on IE.
    The JSF code is as follows:
    <tr>
                                       <td align="right">
                                            Archive Date
                                       </td>
                                       <td align="left" colspan="3">
                                       <table cellpadding="0" cellspacing="0" border="0">
                                       <tr>
                                       <td>
                                       <span class="tuny_text">After&#160;(Ex. Oct 18, 2007)</span>
                                            <h:outputLabel for="txtArchiveDateAfter" value="Archive Date After" rendered="false"/>
                                            <br/>
                                            <t:inputText required="false" value="#{nonItemImageSearchPage.stringArchiveDateAfter}" name="txtArchiveDateAfter" id="txtArchiveDateAfter" forceId="true"  styleClass="inp" style="width: 128px">
                                       </t:inputText>
                                            <t:graphicImage value="/images/calendar.png" id="dtpArchiveDateAfter" name="dtpArchiveDateAfter" forceId="true" style="border: 2px solid #EEE; cursor: pointer"></t:graphicImage>
                                            <br/>
                                            <t:message for="txtArchiveDateAfter" styleClass="form_error" replaceIdWithLabel="true"></t:message>
                                       </td>
                                       <td>
                                       <span class="tuny_text">Before&#160;(Ex. Oct 18, 2007)</span>
                                            <h:outputLabel for="txtArchiveDateBefore" value="Archive Date Before" rendered="false"/>
                                            <br/>
                                            <t:inputText value="#{nonItemImageSearchPage.stringArchiveDateBefore}" name="txtArchiveDateBefore" id="txtArchiveDateBefore" forceId="true" style="width:128px" styleClass="inp">
                                       </t:inputText>
                                            <t:graphicImage value="/images/calendar.png" id="dtpArchiveDateBefore" name="dtpArchiveDateBefore" forceId="true" style="border: 2px solid #EEE; cursor: pointer"></t:graphicImage>
                                            <br/>
                                            <t:message for="txtArchiveDateBefore" styleClass="form_error" replaceIdWithLabel="true"></t:message>
                                       </td>
                                       </tr>
                                       </table>
                                       </td>
                                  </tr>
                                  <tr>
                                       <td align="right" >
                                            <h:outputLabel for="drpBackground" value="Background"/>
                                       </td>
                                       <td align="left" class="right_separator">
                                            <t:selectOneMenu id="drpBackground" forceId="true" value="#{nonItemImageSearchPage.nonItemImageSearchModel.backgroundId}" styleClass="inp" style="width: 150px">
                                            <f:selectItem itemLabel="--------" itemValue="-1"/>
                                            <s:selectItems value="#{nonItemImageSearchPage.backgroundPrefsList}"
                                                      var="backgroundPrefs" itemValue="#{backgroundPrefs.id}" itemLabel="#{backgroundPrefs.description}" />
                                            </t:selectOneMenu>
                                       </td>
                                       <td  align="right" class="left_separator">
                                            <h:outputLabel for="drpTheme" value="Theme"/>
                                       </td>
                                       <td align="left" >
                                            <t:selectOneMenu id="drpTheme" forceId="true" value="#{nonItemImageSearchPage.nonItemImageSearchModel.themeId}" styleClass="inp WCHhider" style="width:150px;">
                                            <f:selectItem itemLabel="--------" itemValue="-1"/>
                                                 <s:selectItems value="#{nonItemImageSearchPage.themePrefsList}"
                                                      var="themePrefs" itemValue="#{themePrefs.id}" itemLabel="#{themePrefs.description}" />
                                            </t:selectOneMenu>
                                       </td>
                                  </tr>
                                  <tr>
                                       <td align="right" >
                                            <h:outputLabel for="drpSeason" value="Season"/>
                                       </td>
                                       <td align="left" class="right_separator">
                                            <t:selectOneMenu id="drpSeason" forceId="true" value="#{nonItemImageSearchPage.nonItemImageSearchModel.seasonId}" styleClass="inp" style="width:150px">
                                            <f:selectItem itemLabel="--------" itemValue="-1"/>
                                                 <s:selectItems value="#{nonItemImageSearchPage.seasonPrefsList}"
                                                      var="seasonPrefs" itemValue="#{seasonPrefs.id}" itemLabel="#{seasonPrefs.description}" />
                                            </t:selectOneMenu>
                                       </td>
                                       <td align="right" class="left_separator">
                                            <h:outputLabel for="drpClothing" value="Clothing"/>
                                       </td>
                                       <td align="left"  >
                                            <t:selectOneMenu id="drpClothing" forceId="true" value="#{nonItemImageSearchPage.nonItemImageSearchModel.clothingId}" styleClass="inp" style="width:150px">
                                            <f:selectItem itemLabel="--------" itemValue="-1"/>
                                                 <s:selectItems value="#{nonItemImageSearchPage.clothingPrefsList}"
                                                      var="clothingPrefs" itemValue="#{clothingPrefs.id}" itemLabel="#{clothingPrefs.description}" />
                                            </t:selectOneMenu>
                                       </td>
                                  </tr>
                                  <tr>
                                       <td align="right" >
                                            <h:outputLabel for="drpToy" value="Toy"/>
                                       </td>
                                       <td align="left" class="right_separator">
                                            <t:selectOneMenu id="drpToy" forceId="true" value="#{nonItemImageSearchPage.nonItemImageSearchModel.toyId}" styleClass="inp" style="width:150px">
                                            <f:selectItem itemLabel="--------" itemValue="-1"/>
                                                 <s:selectItems value="#{nonItemImageSearchPage.toyPrefsList}"
                                                      var="toyPrefs" itemValue="#{toyPrefs.id}" itemLabel="#{toyPrefs.description}" />
                                            </t:selectOneMenu>
                                       </td>
                                       <td align="right" class="left_separator">
                                            <h:outputLabel for="drpJuvenile" value="Juvenile"/>
                                       </td>
                                       <td align="left" >
                                            <t:selectOneMenu id="drpJuvenile" forceId="true" value="#{nonItemImageSearchPage.nonItemImageSearchModel.juvenileId}" styleClass="inp" style="width:150px">
                                            <f:selectItem itemLabel="--------" itemValue="-1"/>
                                                 <s:selectItems value="#{nonItemImageSearchPage.juvenilePrefsList}"
                                                      var="juvenilePrefs" itemValue="#{juvenilePrefs.id}" itemLabel="#{juvenilePrefs.description}" />
                                            </t:selectOneMenu>
                                       </td>
                                  </tr>
                                  <tr>
                                       <td align="right">
                                            <h:outputLabel for="drpGroup" value="Grouping"/>
                                       </td>
                                       <td align="left"  class="right_separator">
                                            <t:selectOneMenu id="drpGroup" forceId="true" value="#{nonItemImageSearchPage.nonItemImageSearchModel.modelGroupingId}" styleClass="inp" style="width:150px;">
                                            <f:selectItem itemLabel="--------" itemValue="-1"/>
                                                 <s:selectItems value="#{nonItemImageSearchPage.groupPrefsList}"
                                                      var="groupPrefs" itemValue="#{groupPrefs.id}" itemLabel="#{groupPrefs.description}" />
                                            </t:selectOneMenu>
                                       </td>
                                       <td class="left_separator">&#160;</td>
                                       <td>&#160;</td>
                                  </tr>
    The JavaScript code is as follows:
    <script type="text/javascript" language="javascript">
         var dtpArchiveDateBefore = new MooCal("txtArchiveDateBefore");
         var dtpArchiveDateAfter = new MooCal("txtArchiveDateAfter");
         window.addEvent("domready", function(){
           $("dtpArchiveDateBefore").addEvent("click", function(e){
                    var event = new Event(e).stop();
                      var x = (event.client.x)-150;
                      var y = event.client.y;
                      dtpArchiveDateBefore.show(x,y);  // Display the calendar at the position of the mouse cursor
                      dtpArchiveDateBefore.minYear = 1800;
                        dtpArchiveDateBefore.maxYear = 2017;
         /*$("txtArchiveDateBefore").addEvent("click", function(e){
                 e.target.blur();
                    var event = new Event(e).stop();
                      var x = (event.client.x)-150;
                      var y = event.client.y;
                      dtpArchiveDateBefore.show(x,y);  // Display the calendar at the position of the mouse cursor
                      dtpArchiveDateBefore.minYear = 1800;
                        dtpArchiveDateBefore.maxYear = 2017;
        $("dtpArchiveDateAfter").addEvent("click", function(e){
                    var event = new Event(e).stop();
                      var x = (event.client.x)-150;
                      var y = event.client.y;
                      dtpArchiveDateAfter.show(x,y);  // Display the calendar at the position of the mouse cursor
                      dtpArchiveDateAfter.minYear = 1800;
                        dtpArchiveDateAfter.maxYear = 2017;
       /* $("txtArchiveDateAfter").addEvent("click", function(e){
                 e.target.blur();
                    var event = new Event(e).stop();
                      var x = (event.client.x)-150;
                      var y = event.client.y;
                      dtpArchiveDateAfter.show(x,y);  // Display the calendar at the position of the mouse cursor
                      dtpArchiveDateAfter.minYear = 1800;
                        dtpArchiveDateAfter.maxYear = 2017;
         </script>When the calendar is above t:selectOneMenu, it doesn't show up on t:selectOneMenu area. Could anyone help me solve the issue?
    Thanks
    Rashed

    There are dozens of CSS attributes that can (and have to) be handwritten. Trouble with them is that, like text shadows, they don't appear in all browsers. I have nine different browsers installed and test pages in ALL of them before I "finish" building site or page for a template.
    I try to build for Firefox, out of personal preference for it, but I have to do things that work with IE because it still holds the market share (46%IE to 42%FF), and I will only go with designs that work in IE, FF, NS, Opera, Safari, and Chrome.
    As to your questions.
    1. The compatibility check is most likely current with the time of the build. I don't know if that component updates as browsers do, but I'd tend to think it doesn't. I'm using CS4  and there haven't been any updates for it in nearly a year. Firefox has released 4.0, Opera released 11, and Safari released 5 since then. The updater would have found and downloaded something if it was available.
    2. I could only guess. Text shadows DON'T show up in design view (or in IE) but they do in browser preview. It's just a UI quirk, and it means "trial and error" is the onyl way to get what you want.
    3. The quick-selects which are in DW dropdowns or popouts are the ones most  common to CSS designs and have been proven to work with all browsers at the time of release of your particular build of DW.
    Hope that helps..

  • SelectOneMenu and ValueChangeListener

    Hi All,
    I am a new user of JSF components. I've got a problem about getting the selected value from the selectedOneMenu component. I have 3 selectOneMenu box and each has valueChangeListener.
    I wanna get first selected id and get the second value according to the first selected id and so on.
    The frist value change listener submit and get the selected value.But when the second value change listener submit the value, the first selectOneMenu also submit the value, so the previous value is lost and return null cause of no selection in the first box.
    I 've separate these component to three separate forms . But when one of the ValueChangeListener is execute, the others also execute.
    So , How can I pass this problem..
    Here is my coding...
    <h:form id="form1">
                        <h:panelGrid columns="3">
                        <h:column><h:outputLabel value="Category L1 : " /> </h:column>
                   <h:column>
                             <h:selectOneMenu id="selectValue"
                                                      onchange="this.form.submit();"
                                                 immediate="true"
                                                 value="#{categoryBean.selectValue}"
                                                 valueChangeListener="#{categoryBean.item1Change}">
                                       <f:selectItems value="#{categoryBean.menuItem1}"/>
                             </h:selectOneMenu>
                        </h:column>     
                        <h:column></h:column>               
                        <h:column><h:outputLabel value="Description : " /></h:column>
                        <h:column><h:outputText value="test" /></h:column>
                        <h:column><h:commandButton action="" value="Add New" /></h:column>
                        </h:panelGrid>
                        <h:inputHidden value="#{categoryBean.tempValue}" />
                   </h:form>
                   <h:form id="form2">
                        <h:panelGrid columns="3">
                        <h:column><h:outputLabel value="Category L2 : " /> </h:column>
                   <h:column>
                             <h:selectOneMenu id="selectValue2"
                                                      onchange="this.form.submit();"
                                                      immediate="true"
                                                      value="#{categoryBean.selectValue2}"
                                                      valueChangeListener="#{categoryBean.item2Change}">
                                       <f:selectItems value="#{categoryBean.menuItem2}"/>
                             </h:selectOneMenu>
                        </h:column>     
                        <h:column></h:column>               
                        <h:column><h:outputLabel value="Description : " /></h:column>
                        <h:column><h:outputText value="test" /></h:column>
                        <h:column><h:commandButton action="" value="Add New" /></h:column>     
                        </h:panelGrid>
                   </h:form>     
                   <h:form id="form3">
                        <h:panelGrid columns="3">
                        <h:column><h:outputLabel value="Category L3 : " /> </h:column>
                   <h:column>
                             <h:selectOneMenu id="selectValue3"
                                                      onchange="this.form.submit();"
                                                 immediate="true"
                                                      value="#{categoryBean.selectValue3}"
                                                      valueChangeListener="#{categoryBean.item3Change}">
                                       <f:selectItems value="#{categoryBean.menuItem3}"/>
                             </h:selectOneMenu>
                        </h:column>     
                        <h:column></h:column>               
                        <h:column><h:outputLabel value="Description : " /></h:column>
                        <h:column><h:outputText value="test" /></h:column>
                        <h:column><h:commandButton action="" value="Add New" /></h:column>
                        </h:panelGrid>     
                   </h:form>          
         public void item1Change(ValueChangeEvent event) {
              Utils.log(getFacesContext(),"Win b kwa...1.........");
              PhaseId phaseId = event.getPhaseId();
              String oldValue = (String) event.getOldValue();
              String newValue = (String) event.getNewValue();
              this.tempValue = newValue;
              if (phaseId.equals(PhaseId.ANY_PHASE))
                   event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
                   event.queue();
              else if (phaseId.equals(PhaseId.UPDATE_MODEL_VALUES))
              Utils.log(getFacesContext(),"New Value is......"+newValue );
              if(newValue == null){
                   logger.info("Next time win tar.....");
              else{
                   this.setSelectValue(newValue);
              Utils.log(getFacesContext(), "In L1 : Selected Value is..."+this.getSelectValue());
              this.menuItem2 = this.getCategoryList(this.getSelectValue());
              FacesContext context = FacesContext.getCurrentInstance();
              context.renderResponse();
    please help me.. thanks in advance...

    There's a few things...
    First, and foremost, is that you have two forms on the page. This is a bad idea with JSF. It tends to mess things up (although, some people may have gotten it to work right). You might want to find a way to have only one h:form tag per page. That shouldn't actually be too hard.
    Next, it looks like you set up your selectOneMenu tags properly. You have the valueChangeListener, immediate=true and a form submit onchange. Good!
    However, the valueChangeListener implementation is different than what I usually see. You're queueing up the event to fire in UPDATE_MODELS phase... This is strange. This will probably undo the fact that you put immediate="true" on your component in the first place.
    My suggestion is not to manipulate the phases this way, for your particular problem. Instead, get the new value and set the selected value (without retrieving the phaseId). Then call facesContext.renderResponse() at the end of your valueChangeListener implementation. Something like this:
    public void item1Change(ValueChangeEvent event) {
        String newValue = (String) event.getNewValue();
        if(newValue == null){
            logger.info("Next time win tar.....");
        else{
             this.setSelectValue(newValue);
        Utils.log(getFacesContext(), "In L1 : Selected Value is..."+this.getSelectValue());
        //What's this?
        this.menuItem2 = this.getCategoryList(this.getSelectValue());
        FacesContext context = FacesContext.getCurrentInstance();
        context.renderResponse();
    }Start there. There may be a few more problems.
    CowKing

  • Using commandLinks and commandButtons in dataTables

    I'm trying to create a page that displays data from a database and allows you to edit individual rows by clicking on either a commandButton or a commandLink within a dataTable that then takes you to another page where you can edit that particular row of the table.
    When using a commandButton, it works perfectly for all but the last entry in the table. But when the button in the last line is clicked, nothing happens at all, it does not seem to call the action listener and it does not perform the navigation based on the action. But with all the previous buttons it calls the actionListener and navigates perfectly. Can anyone tell me why this would be? The code is as follows:
    <h:dataTable value="#{Categories.categories}" var="category" >
    <h:column>
    <f:facet name="header"><h:outputText value="#{msgs.deptColumnHead}"/></f:facet>
    <h:outputText value="#{category.departmentName}"/>
    </h:column>
    <h:column>
    <f:facet name="header"><h:outputText value="#{msgs.categoriesColumnHead}"/></f:facet>
    <h:outputText value="#{category.categoriesList}"/>
    </h:column>
    <h:column>
    <h:form>
    <h:inputHidden id="dept" value="#{category.departmentId}"/>
    <h:commandButton id="editButton" action="EditCat" actionListener="#{Categories.editListener}" value="{msgs.editSelectedButtonText}"/>
    </h:form>
    </h:column>
    </h:dataTable>
    When using commandLinks, only the first one works (of 4). For the other 3 the page goes into error when the link is clicked and it complains that 'document.forms._id2:3:_id10._id2:3:_id10:idcl is null or not an object'. If anyone could tell me what is wrong with my code, i would be most appreciative.
    <h:dataTable value="#{Categories.categories}" var="category" >
    <h:column>
    <f:facet name="header"><h:outputText value="#{msgs.deptColumnHead}"/></f:facet>
    <h:outputText value="#{category.departmentName}"/>
    </h:column>
    <h:column>
    <f:facet name="header"><h:outputText value="#{msgs.categoriesColumnHead}"/></f:facet>
    <h:outputText value="#{category.categoriesList}"/>
    </h:column>
    <h:column>
    <h:form>
    <h:inputHidden id="dept" value="#{category.departmentId}"/>
    <h:commandLink action="EditCat" actionListener="#{Categories.editListener}">
    <h:outputText value="#{msgs.editSelectedButtonText}"/>
    </h:commandLink>
    </h:form>
    </h:column>
    </h:dataTable>

    1) I have had very odd behavior in JSF when ALL of the
    JSF elements on a page do not have an id attribute. If
    you do not assign an id then JSF will manufacture a
    unique id on the flag. Sometimes the unique id wasn't
    so unique and there were errors like you are seeing or
    just odd behavior on the form, buttons not generating
    events, or incorrect rendering, etc.
    By 'ALL' I mean output text, columns, anything that
    accepts an id attribute. Don't trust the code to
    generate an id correctly for you.Just want it known that while this may be necessary in the short-term to work around bugs, this is definitely not the intent of the EG! We don't want people getting in the habit of
    Also note that this behavior is not consistent
    sometimes it would not appear on a page unless the
    page was updated and more controls added to it.Ah, well that is a known issue; while developing a page, the Sun RI can have problems if you change a page's contents between two submissions. (It doesn't pick up that the .jsp has changed.) I'd recommend:
    - Use client-side state saving.
    - Make sure you're making a new request for a page (not re-POST-ing anything!) when the page's contents have changed.
    If you follow both of those rules, then you should generally be able to get away without explicit IDs everywhere as you actively develop your page.
    Explicit IDs are required if you're inside <c:if>; this is known and documented.
    2) try putting the hidden input control in it's own
    columnNo, that'll give you a bonus set of <td> elements, which isn't what you want.
    -- Adam Winer (EG member)

  • CommandLinks and CommandButtons in Datatable do not work

    I have read the threads about this issue and am aware of the fact that there is a problem, if the backing bean is in request scope. However, my backing bean is in session scope and it still does not work - my action methods are never called. What's more, I have another backing bean in session scope, where it works perfectly and I cannot see any difference between them.
    Here's the code, my backing bean is dms:
    <h:form rendered="#{dms.documents.rowCount > 0}">
    <h:dataTable rowClasses="..." headerClass="..." value="#{dms.documents}"
    columnClasses="..." var="item" border="1" cellpadding="2" cellspacing="0">
    <h:column>
    <f:facet name="header">
    <h:outputText>DocName</h:outputText>
    </f:facet>
    <h:commandLink action="#{dms.test}" value="#{item.docName}"/>
    </h:column>
    <h:column>
    <f:facet name="header"/>
    <h:commandButton id="foo" value="View" action="#{dms.test}"/>
    </h:column>
    </h:dataTable>
    <h:commandLink action="#{dms.test}" value="Clickme"/>
    </h:form>
    Here is the code in the backing bean:
    public String test() {
    System.out.println("Hooray");
    return "mainPage";
    And this in faces-config.xml:
    <managed-bean>
    <managed-bean-name>dms</managed-bean-name>
    <managed-bean-class>com.mypackage.DmsController</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    Only the last link, the one outside the datatable and titled "Clickme", works. I can see "Hooray" in the logfile and am redirected to the main page. If I click any of the links or buttons in the datatable, nothing is written to the log and the same page is loaded again, but only the static content is displayed, i.e. no JSF tags are evaluated, they are just dropped. There are, however, a few hidden input fields called javax.faces.ViewState, which I don't know where they are coming from.
    As I said, I have another backing bean in session scope, which is modelled exactly like that and it works there. Maybe JSF apps are supposed to have only one controller?
    Many thanks in advance for any pointers,
    Ulrich
    Edit: It doesn't change anything if I put the backing bean in application scope. I did have the same problem before with my other backing bean, but could solve it there by putting it from request scope to session scope.

    <h:dataTable value="#{dms.documents}">How do you load this list? This list should not be null during the INVOKE_APPLICATION phase.
    Try stubbing the List right in the getDocuments() method and see if it works.

  • How can I control the width of an inputText and commandButton components

    I need to set the width for both &lt;af:inputText/&gt; and &lt;af: CommandButton/&gt; , but I couldn&rsquo;t find the width property in the &ldquo;Property inspector&rdquo; for them, Is there a way to do it ? Thanks.

    Msrping,
    Always mention the Version of Jdeveloper which you are using.
    If you are using Jdeveloper 11.1.1.0.1 than try this:
    <af:inputText/> :: Goto Property Inspector > Appearance > Column(Set the value for this property. ex, 10)
    <af: CommandButton/> :: Goto Property Inspector > style > Box tab > width(Set the value for this property, ex, 50)
    ---Neelmani Jaiswal

  • Error commandlink  and commandbutton

    Hi.
    I have a sample page whith a datatable who rows are commandlinks that (action procedure1).
    I this page I have a button that re-execute a query who provide rows to datatable (action procedure2).
    When I click in a row the commandlink works ok calling procedure1...
    when I click in button the procedure1() is called first time, and when I click in button second time is that procedure2() is called.
    <h:column binding="#{P0110.column4}" id="column4">
    <h:commandLink action="#{P0110.procedure1}" binding="#{P0110.linkAction1}" id="linkAction1">
    <h:outputText binding="#{P0110.outputText10}" id="outputText10" value="#{currentRow['Descricao']}"/>
    </h:commandLink>
    <f:facet name="header">
    <h:outputText binding="#{P0110.outputText11}" id="outputText11" value="Descri��o"/>
    </f:facet>
    </h:column>
    <h:commandButton action="#{P0110.procedure2}" binding="#{P0110.button2}" id="button2" style="left: 920px; top: 76px; position: absolute" value="Executa"/>
    PS: My procedure1 call a page with "this.getExternalContext().redirect( this.getExternalContext().getRequestContextPath() + "/faces/"+NomePag+".jsp);"

    Hi Runa.
    this is a sample example that I create using pointbase. Please, test, that you undestand better my question.
    </head>
    <body style="-rave-layout: grid">
    <h:form binding="#{Page1.form1}" id="form1">
    <h:dataTable binding="#{Page1.dataTable1}" headerClass="list-header" id="dataTable1" rowClasses="list-row-even,list-row-odd"
    style="left: 300px; top: 90px; position: absolute" value="#{Page1.dataTable1Model}" var="currentRow">
    <h:column binding="#{Page1.column2}" id="column2">
    <h:commandLink action="#{Page1.acionaModulo}" binding="#{Page1.linkAction1}" id="linkAction1">
    <h:outputText binding="#{Page1.outputText3}" id="outputText3" value="#{currentRow['NAME']}"/>
    </h:commandLink>
    <f:facet name="header">
    <h:outputText binding="#{Page1.outputText4}" id="outputText4" value="NAME"/>
    </f:facet>
    </h:column>
    </h:dataTable>
    <h:commandButton action="#{Page1.button1_action}" binding="#{Page1.button1}" id="button1" style="left: 555px; top: 70px; position: absolute" value="Submit"/>
    </h:form>
    </body>
    public Page1() {
    // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
    try {
    personRowSet.setDataSourceName("java:comp/env/jdbc/Travel");
    personRowSet.setCommand("SELECT * FROM TRAVEL.PERSON");
    dataTable1Model.setDataCacheKey("com.sun.datacache.Page1.personRowSet");
    dataTable1Model.setRowSet(personRowSet);
    dataTable1Model.setSchemaName("TRAVEL");
    dataTable1Model.setTableName("PERSON");
    } catch (Exception e) {
    log("Page1 Initialization Failure", e);
    throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
    // </editor-fold>
    // Additional user provided initialization code
    public String acionaModulo() {
    try {
    this.getExternalContext().redirect( this.getExternalContext().getRequestContextPath() + "/faces/page1.jsp");
    catch (IOException e) {
    log("P0110 acionaModulo() ", e);
    error("Detail:P0110 acionaModulo(): " + e);
    return null;
    protected void afterRenderResponse() {
    personRowSet.close();
    public String button1_action() {
    try {
    personRowSet.setCommand("SELECT * FROM TRAVEL.PERSON where NAME> 'B'");
    dataTable1Model.execute();
    } catch (Exception e) {
    log("Page1 Initialization Failure", e);
    throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
    return null;
    To make the error :
    1) click in a line . You obtain an 404 error (no problem)
    2) Return to page before and click in button.
    3) The expected result was a new rowset because the execution of a second query, but the action is the execution of acionaModulo
    Thanks.
    Heitor.

  • Dialog framework and commandButton doesn't display in new window

    I'm using a af:commandButton to launch a dialog in a new windows with no luck
    I'm using EA1 and ADF EA 19, my command button is
    <af:commandButton text="dialogo"
    launchListener="#{controladorLink.launch}"
    useWindow="true"
    returnListener="#{controladorLink.regreso}"
    partialSubmit="true"
    action="#{controladorLink.accion}"
    actionListener="#{controladorLink.actionListener}"
    windowHeight="200" windowWidth="300">
    Am I doing something wrong? According to the Dialog Framework documentation you need to set an "useDialog" attribute, but it doesn't exists in commandButton, do I need to use commandLink necessarily?
    Thanks

    Did you take care of these requirements?
    The value bound to the action should return a string of the form "dialog:.....".
    Eg: <af:commandButton text="Show More Information"
    action="dialog:showDetail"/>
    And there is a navigation-case that needs to be added to the faces-config.
    <navigation-rule>
    <from-view-id>/*</from-view-id>
    <navigation-case>
    <from-outcome>dialog:showDetail</from-outcome>
    <to-view-id>/showDetail.jspx</to-view-id>
    </navigation-case>
    </navigation-rule>
    Hope this helps.
    Thanks,
    Balaji

  • h:selectOneMenu and "value" attribute

    I have an issue with the <h:selectOneMenu> tag. On a page I've written, the select items are populated with a <f:selectItems> tag that is bound to a managed bean property with session scope which queries from a database table for the select items. The <h:selectOneMenu> value property - which determines the item that is selected - is bound to a property of a managed bean that has session scope.
    There is a button on the screen that causes navigation to a new screen. On this screen, the user can add an entry to the database table from which the <f:selectItems> are populated. The event handler for the second screen adds a new item to the database table and sets the property on the managed bean to that determines which item is selected on the previous screen to this new value.
    The problem I have is that the new item is added to the list, but it is not the selected item when the first screen is navigated back to. If I view the HTML code generated, none of the <option> tags contains the "SELECTED" property. Strangely, if I enter a new item that is less - alphabetically - than the existing items, it will be selected, but if I add an item that falls into the middle of the list or the end of the list alphabetically, it is not selected.
    I don't know what to do here. Is there some requirement about sorting the collection that backs the <f:selecteditems> facet? This doesn't seem likely since I've tried various sorts to figure this out and nothing has worked. Is there a known bug setting the value property of <h:selectOneMenu>?
    Any ideas?

    When your setting the value for the <h:selectOneMenu> make sure its a string!
    Here is a simple example
    (.jsp page)
    <h:selectOneMenu id="locationID" value="2">
       <f:selectItems value="#{LocationList.itemList}"/>
    </h:selectOneMenu>
    (HTML Code that gets generated from the .jsp page
    <select id="edit:locationID" name="edit:locationID" size="1">
       <option value="1">Anoka</option>
       <option value="2"  selected>MSO</option>
    </select>

  • Error  while working with JSF SelectOneMenu and JSTL forEach Tag

    Hello,
    I have set up few things in ArrayList in my contextListener as like below
    ServletContext context=event.getServletContext();
    List list=new ArrayList();
    list1.add("Honda");
    list1.add("Mazda");
    list1.add("eClipse");
    context.setAttribute("carList", list)
    I just wanted to display the list in my JSF page, I wrote the below statements in my JSF page
    <h:selectOneMenu value="{com.carSelection}">
    <c:forEach var="car" items="${applicationScope.carList}" >
    <f:selectItem itemLabel="${car}"/>
    </c:forEach>
    </h:selectOneMenu>
    I am getting the below exception
    org.apache.jasper.JasperException: /pages/protected/cmt/index.jsp(23,2) According to TLD or attribute directive in tag file, attribute itemLabel does not accept any expressions
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
    org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1124)
    org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:819)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1512)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
    org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:838)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1512)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
    org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator
    Could some one help to solve this error (Or) How should I display from my applicationScope list into MenuItems ?
    Edited by: Saravvij on Apr 9, 2008 8:37 PM
    Edited by: Saravvij on Apr 9, 2008 8:38 PM

    Hi,
    get your original message source from SXMB_MONI
    (right click - view source ) then paste your message to your message mapping (Test Tab) in the Integration Repository
    test your mapping and check if it's ok
    Regards,
    michal

  • H:selectOneMenu and its value parameter trouble

    Hello!
    I have a form in my jsp page ^
    <h:dataTable id="table" value="#{Reference.template.fields}" var="list" rowClasses="list_row_odd, list_row_even" columnClasses="align_right, align_left" width="100%" border="0" cellpadding="4" cellspacing="1">
                <h:column rendered="#{(list.label != 'code')}">
                  <h:outputText value="#{list.label}" escape="false"/>
                </h:column>
                <h:column rendered="#{(list.optionsSize < 1)&&(list.label != 'code')}">
                  <h:inputText id="ref_input" value="#{Reference.faculty}" readonly="true" rendered="#{list.label == '&#1060;&#1072;&#1082;&#1091;&#1083;&#1100;&#1090;&#1077;&#1090;'}" size="50"/>
                  <h:inputText id="ref_input_1" value="#{list.value}" rendered="#{(list.label != '&#1060;&#1072;&#1082;&#1091;&#1083;&#1100;&#1090;&#1077;&#1090;') && (list.value == '')}" size="50"/>
                  <h:inputText id="ref_input_2" value="#{list.value}" readonly="true" rendered="#{(list.label != '&#1060;&#1072;&#1082;&#1091;&#1083;&#1100;&#1090;&#1077;&#1090;') && (list.value != '')}" size="50"/>
                </h:column>
                <h:column rendered="#{(list.optionsSize > 0) && (list.label != 'code')}">
    // here is the problem -----------------------------
                  <h:selectOneMenu id="list" value="#{list.value}">
                    <f:selectItems value="#{list.options}" />
                  </h:selectOneMenu>
                </h:column>
                <h:column rendered="#{(list.label != 'code')}">
                  <h:outputText value="#{list.lov}" escape="false"/>
                </h:column>
              </h:dataTable>the trouble is if there is a value parameter, the form is submitted to server
    as empty one, if there isn't value parameter it works well.
    list.getValue - returns String
    and i strongly need to show the selected value!!!1
    Please help

    I'm not talking about JavaScript.
    I would like to write my own Java function:
    String formatStatus(String status, Date date) {
    If (status.equals("A"))
    return "Active from date " + date;
    else
    return "Not active";
    and then to replace inside my dataTable's column:
    <h:outputText id="text2" value="#{varpaketi.status}" />
    with:
    <h:outputText id="text2" value="#{pc_Paketi.formatStatus($status, $date)}" />
    where $status and $date are dataset variables which were displayed in column of my datatable.

Maybe you are looking for

  • How do I rename a lot of files from an excel worksheet?

    Hello all! I have 2k+ files in a folder named sequentially from 0001.wav to 24xx.wav. I have their contents referenced in an .xls. This is a library made for Windows when it didn't accept very long names, so you couldn't just name the file accordingl

  • How to increase display field size of parameter in Oracle BI P11.1.1.6.5

    Hi, Can somebody help me on this issue? On my report, I have to display labels with a length of 35 or more character for parameters. ex."Please Enter the Payment Date(MM/DD/YYYY)*". But When I try to run the report in BI Publisher, I am seeing the di

  • Private access

    I have a abstract class Point with one field : xValue declared as private. I defined a getXvalue() method then I made a subclass of point with a new field yValue my getXvalue() methaod looks as follows: public double getXvalue() { return this.xValue;

  • Oracle Weblogic server and OSGi support

    I am working on OSGi implementations (Equinox/Apache Felix), application is full Spring MVC based, using Spring DM(Latest versions Gemini Blueprint and Eclipse Virgo) to deploy bundles. I couldn't able to deploy Web application as an OSGi bundle. It

  • Premiere CC stürzt ab

    Ich habe ein Projekt in Premiere CC geschnitten. Wenn ich es jetzt öffne stürzt es sofort ab. Nun habe ich heraus gefunden, dass auch ein neues Projekt abstürzt, sobald ich Material importiere. Hierbei ist egal, ob es das selbe Material oder anderes