2010-06-15 4 views
1

Я использую hx:commandExButton IBM Faces Client Framework для вызова моего метода. Но метод не вызван. Но если я использую immediate="true", он будет вызван. Но, как вы все это знаете, моя модель не будет обновляться, поэтому мне это бесполезно.jsf submit кнопка не работает

Неужели кто-нибудь сталкивался с этим? Проверьте hx:commandExButton id="btnSearch"

<%-- tpl:metadata --%> 
    <%-- jsf:pagecode language="java" location="/src/pagecode/view/costestimation/SearchAssignee.java" --%><%-- /jsf:pagecode --%> 
<%-- /tpl:metadata --%> 
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%><%@taglib 
    prefix="h" uri="http://java.sun.com/jsf/html"%><%@taglib 
    uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%><%@taglib 
    uri="http://java.sun.com/portlet_2_0" prefix="portlet"%><%@taglib 
    uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model" 
    prefix="portlet-client-model"%><%@page language="java" 
    contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><portlet-client-model:init> 
    <portlet-client-model:require module="ibm.portal.xml.*" /> 
    <portlet-client-model:require module="ibm.portal.portlet.*" /> 
</portlet-client-model:init> 
<portlet:defineObjects /> 
<link rel="stylesheet" type="text/css" title="Style" 
    href="../../theme/stylesheet.css"> 
<f:view> 
    <f:loadBundle var="giamsBundle" 
     basename="com.ibm.costprojectionportlet.nl.GIAMSResourceBundle" /> 
    <hx:viewFragment id="viewFragment1"> 

     <hx:scriptCollector id="scriptCollector1"> 

      <script language="JavaScript" 
       src='<%=renderResponse.encodeURL(renderRequest 
             .getContextPath() 
             + "/js/common.js")%>'></script> 

      <h:outputText value="<br/>" escape="false" /> 

      <h:outputText id="titleSearch" styleClass="outputText" 
       value="#{giamsBundle['title.search']}" escape="false"></h:outputText> 

      <h:outputText value="<br/>" escape="false" /> 

      <h:messages style="font-weight:bold;color:red;" layout="table"></h:messages> 

      <hx:panelSection styleClass="panelSection" title="SearchCriteria" 
       id="searchCriteriaPanel" initClosed="false" 
       style="border-width: thin; border-style: groove"> 
       <h:form styleClass="form" id="searchCriteriaForm"> 
        <h:messages style="font-weight:bold;color:red;" layout="table"></h:messages> 
        <h:panelGrid columns="2" cellpadding="1" border="0" width="100%"> 
         <h:column> 
          <hx:panelFormBox helpPosition="over" labelPosition="left" 
           styleClass="panelFormBox" id="formBoxLeft"> 
           <hx:formItem styleClass="formItem" id="frmLastName" 
            label="#{giamsBundle['lbl.search.lastname']}" escape="false"> 
            <h:inputText styleClass="inputText" size="20" id="txtLastName" 
             value="#{pc_SearchAssignee.assignee.lastName}"> 
            </h:inputText> 
           </hx:formItem> 

           <hx:formItem styleClass="formItem" id="frmHomeCountrySerial" 
            label="#{giamsBundle['lbl.search.homecountryserial']}" 
            escape="false"> 
            <h:inputText styleClass="inputText" size="20" 
             id="txtHomeCountrySerial" 
             value="#{pc_SearchAssignee.assignee.companyDetails.homeCountrySerial}"> 
            </h:inputText> 
           </hx:formItem> 

           <hx:formItem styleClass="formItem" id="frmHomeCountry" 
            label="#{giamsBundle['lbl.search.homecountry']}" escape="false"> 
            <h:selectOneMenu styleClass="selectOneMenu" id="ddHomeCountry" 
             value=""> 
             <f:selectItems value="#{pc_referenceData.telephoneTypeList}" /> 
            </h:selectOneMenu> 
           </hx:formItem> 

           <hx:formItem styleClass="formItem" id="frmHomeBusinessUnit" 
            label="#{giamsBundle['lbl.search.homebusunit']}" escape="false"> 
            <h:selectOneMenu styleClass="selectOneMenu" value="" 
             id="ddHomeBusinessUnit"> 
             <f:selectItems value="#{pc_referenceData.telephoneTypeList}" /> 
            </h:selectOneMenu> 
           </hx:formItem> 

           <hx:formItem styleClass="formItem" id="frmforButtons" label="" 
            escape="false"> 
            <h:panelGroup> 
             <hx:commandExButton styleClass="commandExButton" 
              id="btnSearch" value="#{giamsBundle['btn.search']}" 
              action="#{pc_SearchAssignee.searchAssignee}"> 
             </hx:commandExButton> 
             <hx:commandExButton styleClass="commandExButton" 
              id="btnCancel" value="#{giamsBundle['btn.cancel']}" 
              action="#{pc_SearchAssignee.searchAssignee}"> 
             </hx:commandExButton> 
            </h:panelGroup> 
           </hx:formItem> 

          </hx:panelFormBox> 
         </h:column> 

         <h:column> 
          <hx:panelFormBox helpPosition="over" labelPosition="left" 
           styleClass="panelFormBox" id="formBoxRight"> 

           <hx:formItem styleClass="formItem" id="frmFirstName" 
            label="#{giamsBundle['lbl.search.firstname']}" escape="false"> 
            <h:inputText styleClass="inputText" size="20" id="txtFirstName" 
             value="#{pc_SearchAssignee.assignee.firstName}"> 
            </h:inputText> 
           </hx:formItem> 

           <hx:formItem styleClass="formItem" id="frmHomeNotesEmail" 
            label="#{giamsBundle['lbl.search.homenotesemail']}" 
            escape="false"> 
            <h:panelGroup> 
             <h:inputText styleClass="inputText" size="20" 
              id="txtHomeNotesEmail" 
              value="#{pc_SearchAssignee.assignee.lotusNotesId}"> 
             </h:inputText> 
            </h:panelGroup> 
           </hx:formItem> 

           <hx:formItem styleClass="formItem" id="frmHomeLocation" 
            label="#{giamsBundle['lbl.search.homeloc']}" escape="false"> 
            <h:inputText styleClass="inputText" size="20" 
             id="txtHomeLocation" 
             value="#{pc_SearchAssignee.assignee.homeAddress.cityName}"> 
            </h:inputText> 
           </hx:formItem> 

           <hx:formItem styleClass="formItem" id="blank" label="" 
            escape="false"> 
            <h:outputText id="txtblank" escape="false"></h:outputText> 
           </hx:formItem> 

          </hx:panelFormBox> 
         </h:column> 
        </h:panelGrid> 
       </h:form> 

       <f:facet name="opened"> 
        <hx:jspPanel id="jspPanelMainOpen"> 
         <hx:graphicImageEx id="imageExMainOpen" 
          styleClass="graphicImageEx" align="middle" 
          value="/theme/img/form_header.GIF" width="100%" height="20"></hx:graphicImageEx> 

        </hx:jspPanel> 
       </f:facet> 

      </hx:panelSection> 



      <h:outputText id="titleResults" styleClass="outputText" 
       value="#{giamsBundle['lbl.search.results']}" escape="false"></h:outputText> 

      <h:outputText value="<br/>" escape="false" /> 

      <hx:dataTableEx border="0" cellspacing="2" width="100%" 
       columnClasses="columnClass1" headerClass="headerClass" 
       footerClass="footerClass" rowClasses="rowClass1, rowClass2" 
       styleClass="dataTableEx" id="searchAssignee" 
       value="#{pc_SearchAssignee.assigneeList}" var="searchitr" 
       binding="#{pc_SearchAssignee.searchDataTable}" 
       rendered="#{pc_SearchAssignee.render}"> 

       <hx:columnEx id="columnEx1"> 
        <f:facet name="header"> 
         <hx:panelBox styleClass="panelBox" id="selectPanelBox"> 
          <hx:outputSelecticons styleClass="outputSelecticons" 
           id="selectCheckBox"></hx:outputSelecticons> 
         </hx:panelBox> 
        </f:facet> 

        <hx:inputRowSelect styleClass="inputRowSelect" 
         value="#{searchitr.selected}" id="rowSelect"></hx:inputRowSelect> 
        <f:facet name="header"></f:facet> 
       </hx:columnEx> 

       <hx:columnEx id="columnEx2"> 
        <f:facet name="header"> 
         <h:outputText id="lblEeId" styleClass="outputText" 
          value="#{giamsBundle['lbl.search.eeid']}"></h:outputText> 
        </f:facet> 

        <h:inputText styleClass="inputText" id="dttxtEEID" 
         value="#{searchitr.employeeID}"></h:inputText> 
       </hx:columnEx> 

       <hx:columnEx id="columnEx3"> 
        <f:facet name="header"> 
         <h:outputText id="lblFirstName" styleClass="outputText" 
          value="#{giamsBundle['lbl.search.firstname']}"></h:outputText> 
        </f:facet> 

        <h:inputText styleClass="inputText" id="dttxtFirstName" 
         value="#{searchitr.firstName}"></h:inputText> 
       </hx:columnEx> 

       <hx:columnEx id="columnEx4"> 
        <f:facet name="header"> 
         <h:outputText id="lblLastName" styleClass="outputText" 
          value="#{giamsBundle['lbl.search.lastname']}"></h:outputText> 
        </f:facet> 

        <h:inputText styleClass="inputText" id="dttxtLastName" 
         value="#{searchitr.lastName}"></h:inputText> 
       </hx:columnEx> 

       <hx:columnEx id="columnEx5"> 
        <f:facet name="header"> 
         <h:outputText id="lblHomeNotesEmail" styleClass="outputText" 
          value="#{giamsBundle['lbl.search.homenotesemail']}"></h:outputText> 
        </f:facet> 

        <h:inputText styleClass="inputText" id="dttxtHomeNotesEmail" 
         value="#{searchitr.homeAddress.addressLine1}"></h:inputText> 
       </hx:columnEx> 

       <hx:columnEx id="columnEx6"> 
        <f:facet name="header"> 
         <h:outputText id="lblHomeCountry" styleClass="outputText" 
          value="#{giamsBundle['lbl.search.homecountry']}"></h:outputText> 
        </f:facet> 

        <h:inputText styleClass="inputText" id="dttxtHomeCountry" 
         value="#{searchitr.homeAddress.addressLine1}"></h:inputText> 
       </hx:columnEx> 

       <hx:columnEx id="columnEx7"> 
        <f:facet name="header"> 
         <h:outputText id="lblHomeLocation" styleClass="outputText" 
          value="#{giamsBundle['lbl.search.homeloc']}"></h:outputText> 
        </f:facet> 

        <h:inputText styleClass="inputText" id="dttxtHomeLocation" 
         value="#{searchitr.homeTaxID}"></h:inputText> 
       </hx:columnEx> 

       <hx:columnEx id="columnEx8"> 
        <f:facet name="header"> 
         <h:outputText id="lblHomeBusUnit" styleClass="outputText" 
          value="#{giamsBundle['lbl.search.homebusunit']}"></h:outputText> 
        </f:facet> 

        <h:inputText styleClass="inputText" id="dttxtHomeBusUnit" 
         value="#{searchitr.homeTaxID}"></h:inputText> 
       </hx:columnEx> 

       <hx:columnEx id="columnEx9"> 
        <f:facet name="header"> 
         <h:outputText id="lblAssignStatus" styleClass="outputText" 
          value="#{giamsBundle['lbl.search.assignmentstatus']}"></h:outputText> 
        </f:facet> 

        <h:inputText styleClass="inputText" id="dttxtAssignStatus" 
         value="#{searchitr.homeTaxID}"></h:inputText> 
       </hx:columnEx> 

      </hx:dataTableEx> 

      <h:outputText value="<br/>" escape="false" /> 

      <hx:commandExButton type="submit" styleClass="commandExButton" 
       rendered="#{pc_SearchAssignee.render}" id="btnContinue" 
       value="#{giamsBundle['btn.continue']}" 
       action="#{pc_SearchAssignee.searchAssignee}"> 
      </hx:commandExButton> 

     </hx:scriptCollector> 
    </hx:viewFragment> 
</f:view> 

ответ

1

Но если я использую immediate="true" это вызывалось

Других слов, он отлично работает, когда не- immediate входных значения не получают собраны, проверены, преобразуется и обновлено в модели. Так что там что-то не получилось. Я вижу, что вы добавили <h:messages/>, поэтому вам следует получить уведомление о любых ошибках проверки/преобразования. Вы также обратили внимание на это?

1

У меня была аналогичная проблема с обновлением чужого кода от JSF 1.1 до JSF 1.2 (работающего на WebSphere Application Server 7.0), в результате чего команда hx: commandExButton не вызывала метод. Кнопка была заключена в тег hx: jspPanel. Когда я удалю этот тег, кнопка будет работать. К сожалению для меня мне нужен тег hx: jspPanel для отображения разных тем. Думаю, мне придется выбирать другой способ выбора между темами. Отстой.

Update:

я был в состоянии заменить Нх: jspPanel с ч: panelGroups в JSF 1.2 и все работало. Уф!

+0

Этот ответ не полезен, так как его командаExButton не находится в jspPanel ... – Blaskovicz

0

Решения/Fix

Solution1: изменение JSP - нужно поместить час: commandLink или Нх: commandExButton вне Нхов: jspPanel петля. Воздействие. Возможно, изменение дизайна пользовательского интерфейса (посмотрите &) требует реализации этого решения.

Решение2: Изменение JSP - требуется заменить hx: jspPanel на h: panelGroup . Воздействие. Для изменения дизайна пользовательского интерфейса не требуется внедрение этого решения.

 Смежные вопросы

  • Нет связанных вопросов^_^