Command Link : Backing bean setters/getters always invoked

I am trying to understand how to the setters and getters of a request scope managed backing bean are invoked through the navigation flow when using a command link.
It seems that no matter where the navigation rules redirects the page as a result of the action, both the setters and getters of any field bound in the originating page are called.
For example if the originating page has a field name referred by "#{UserBean.name}" to input a username. setName() and getName() are always called as a result of a click on a command link
This behavior is easily seen in a simple JSF example such as http://www.netbeans.org/kb/articles/jAstrologer-intro.html.
If the jsp pointed by "to-view-id" is changed to have no reference to the backing bean or is changed to a jsp with just text, both setters and getters are still invoked.
I could understand why the setters would be invoked (doesn't know ahead of time if the bean will be used?) but at least why the getters?
Last, how to prevent this behavior? The problem is that the backing bean might have complex logic where it will fetch data if a getter is called.
Thanks.

I guess this article might be interesting to get some insights http://balusc.xs4all.nl/srv/dev-jep-djl.html
The setters are invoked to set values and the getters are invoked to get the eventually presetted default values or the previously submitted values.

Similar Messages

  • a4j:commandButton Back end bean method is not invoked on click event.

    I am using below code. It seems back end bean method is not called when I click commandbutton. I think it has some thing to with rendering.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:a4j="http://richfaces.org/a4j"
         xmlns:rich="http://richfaces.org/rich"
         xmlns:cdm="http://mportal.com/cdm">
    <ui:composition>
         <rich:panel>
              <a4j:form id="RefreshPropertiesInstanceForm">
                   <table id="RefreshPropertiesTable" width="100%" border="0">
                        <tr>
                             <td width="35%" align="right">
                             <div class="fieldLabel">Property File Name :<span
                                  class="requiredField">*</span></div>
                             </td>
                             <td style="margin-top: 15px; padding-left: 15px" nowrap="nowrap"
                                  align="left"><rich:comboBox id="combo"
                                  value="#{testPropertyRefreshHelper.selectedPropertyFile}"
                                  enableManualInput="false">
                                  <f:selectItems value="#{testPropertyRefreshDetails.propertyFileNameList}" />
                                  <a4j:support event="onchange"
                                       reRender="RefreshPropertiesInstanceForm" BypassUpdates="false"
                                       ajaxSingle="true" action="#{testPropertyRefreshHelper.getPropertyFileContentFromRemoteServer}" />
                             </rich:comboBox></td>
                        </tr>
                        <tr>
                             <td style="margin-top: 10px; padding-left: 100px" align="left"
                                  colspan="3"><h:inputTextarea id="firstTextArea" value="#{testPropertyRefreshHelper.propertyFileContent}"
                                  rows="21" cols="150"
                                  style="overflow-x: auto; overflow-y: scroll"
                                  rendered="#{testPropertyRefreshHelper.selectedPropertyFile != 'Choose from below'}"
                                  disabled="#{testPropertyRefreshHelper.selectedPropertyFile == 'Choose from below'}">
                             </h:inputTextarea></td>
                        </tr>
                        <tr>
                             <td style="margin-top: 10px; padding-left: 400px" align="left"
                                  colspan="2">
                             <a4j:commandButton id='refreshPropertyButton' value="refresh"
                                  image="#{imageManager.imageMap['REFRESH_BUTTON']}"
                                  rendered="#{testPropertyRefreshHelper.selectedPropertyFile != 'Choose from below'}"
                                  action="#{testPropertyRefreshHelper.updatePropertyFileContentInRemoteServer}"
                                  reRender="RefreshPropertiesInstanceForm" >     
                             </a4j:commandButton>
                             </td>
                        </tr>
                   </table>
              </a4j:form>
         </rich:panel>
    </ui:composition>
    </html>
    Every thing works perfectly. But when I click command button "#{testPropertyRefreshHelper.updatePropertyFileContentInRemoteServer}" backing bean method is not invoked. Other componenets are working properly.

    try what the linked article says: make your bean session scoped.
    NOTE: when working with Ajax I tend to make the backing bean session scoped to have less issues with partial updates and such. If you use JSF 2.0 you could make it view scoped to get the same result.

  • JSF Problem invoking backing bean method

    I want a backing bean method to be invoked when the submit button is clicked but for some strange reason the method is not getting invoked any Help in this regards would be great.
    I am able to properly get the values from database and display on the page , after the user types in some more additional information like password , hint question the form has to be submitted when clicked on the submit button..
    Register.jsp
    <body>
         <f:view>
         <h:graphicImage url="/header.jpg"></h:graphicImage>
               <br><h:form id="user">
                        <table>
                        <tr>
                             <td>
                                  <h:outputLabel for="" value="uUser Name:" styleClass="orderlabelcell"></h:outputLabel></td><td>
                                  <h:inputText onblur="JavaScript:doSubmit();" value="#{registerFormBean.userName}" id="userName"></h:inputText>
                             </td>
                        </tr>
                        <tr>     
                             <td>
                             <h:outputLabel for="" value="First Name:" styleClass="orderlabelcell"></h:outputLabel></td><td>
                             <h:inputText value="#{registerFormBean.firstName}" id="firstName"></h:inputText></td>
                        </tr>
                        <tr>     
                             <td><h:outputLabel for="" value="Middle Name:" styleClass="orderlabelcell"></h:outputLabel></td><td>
                             <h:inputText id="middleName" value="#{registerFormBean.middleName}"></h:inputText></td>
                        </tr>
                        <tr>     
                             <td><h:outputLabel for="" value="Last Name:" styleClass="orderlabelcell"></h:outputLabel></td><td>
                             <h:inputText id="lastName" value="#{registerFormBean.lastName}"></h:inputText></td>
                        </tr>
                        <tr>
                             <td>
                                  <h:outputLabel for="" value="Password:" styleClass="orderlabelcell"></h:outputLabel></td><td>
                                  <h:inputText id="password" value="#{registerFormBean.password}"></h:inputText>
                             </td>
                        </tr>
                        <tr>     
                             <td><h:outputLabel for="" value="Re-type Password:" styleClass="orderlabelcell"></h:outputLabel></td><td>
                             <h:inputText></h:inputText></td>
                        </tr>
                        <tr>     
                             <td><h:outputLabel for="" value="Password Hint Question:" styleClass="orderlabelcell"></h:outputLabel></td><td>
                             <h:inputTextarea id="hintQuestion" value="#{registerFormBean.hintQuestion}"></h:inputTextarea></td>
                        </tr>
                        <tr>     
                             <td><h:outputLabel for="" value="Password Hint Answer:" styleClass="orderlabelcell"></h:outputLabel></td><td>
                             <h:inputTextarea id="hintAnswer" value="#{registerFormBean.hintAnswer}"></h:inputTextarea></td>
                        </tr>
                        <tr>     
                             <td>
                                  <h:commandButton id="submit" value="Submit" type="submit" action="#{registerFormBean.saveUser}"/>
                                  <h:commandButton id="Reset" value="Reset" type="reset"/>
                                  </td>
                        </tr>
                        </table>
                   </h:form>
         </f:view>
    </body> 
    RegisterFormBean.java
      package services;
    import java.sql.SQLException;
    import java.util.ArrayList;
    import dao.DatabaseHandler;
    import model.User;
    public class RegisterFormBean {
    User selectedUser;
    String userName;
    String firstName;
    String middleName;
    String lastName;
    String password;
    String hintQuestion;
    String hintAnswer;
    String errMsg;
    private DatabaseHandler dbHandle;
    public RegisterFormBean() {
         javax.faces.context.FacesContext context = javax.faces.context.FacesContext.getCurrentInstance();
         javax.faces.application.Application app = context.getApplication();
         dbHandle = (DatabaseHandler)app.createValueBinding("#{databaseHandler}").getValue(context);
    public void setUserDetails() {
         try{
              System.out.println("gettting Details for user: "+userName);
              selectedUser = (User)dbHandle.getUser(userName);
         catch (SQLException e) {
              errMsg = "Problem gettting records";
    public String getUserName() {
         if(null!=userName){
              setUserDetails();
         if(null!=selectedUser)
              return selectedUser.getLoginName();
         else
         return "";
    public void setUserName(String userName){
         this.userName = userName;
    public String getFirstName() {
         if(null!=selectedUser)
              return selectedUser.getFirstName();
         else
         return "";
    public void setFirstName(String firstName) {
         System.out.println("in setFirst name");
         this.firstName = firstName;
    public String getMiddleName() {
         if(null!=selectedUser)
              return selectedUser.getMiddleName();
         else
         return "";
    public void setMiddleName(String middleName) {
         System.out.println("in set middle name...");
         this.middleName = middleName;
    public String getLastName() {
         if(null!=selectedUser)
              return selectedUser.getLastName();
         else
         return "";
    public void setLastName(String lastName) {
         System.out.println("in set last name....");
         this.lastName = lastName;
    public String getPassword() {
         return password;
    public void setPassword(String password) {
         if(null!=password){
              System.out.println("$$$$$$$$$$$$ setting password.."+password);
              selectedUser.setPassword(password);
    public String getHintQuestion() {
         return hintQuestion;
    public void setHintQuestion(String hintQuestion) {
         if(null!=hintQuestion){
              System.out.println("#########  Hint Question "+hintQuestion);
              selectedUser.setHintQuestion(hintQuestion);
    public String getHintAnswer() {
         return hintAnswer;
    public void setHintAnswer(String hintAnswer) {
         if(null!=hintAnswer){
              System.out.println("@@@@@@@  Hint Answer"+hintAnswer);
              selectedUser.setHintQuestion(hintAnswer);
    public String saveUser(){
         String flag = "";
         System.out.println("IN registerUser Method....");
         try{
              if(null!=selectedUser){
                   flag = dbHandle.registerUser(setUserDefaults(selectedUser));
         catch(SQLException se){
         flag="fail";
         System.out.println("FAILED DUE TO THE EXCEPTION :- "+se.getMessage());
         errMsg = "Unable to Register the User...";
         return flag;
    public User setUserDefaults(User user){
         System.out.println("SETTING USER DEFAULTS.....");
         user.setActive(true);
         user.setLoginType("False");
         user.setCreatedUserName("SOMEUSERNAME");
         user.setSecIdFunctionGroup(17);
         user.setChallangeWord("CHANGE IT");
         user.setTrusted(false);
         user.setUserTypeIdTypeOf(1);
         user.setChangePwdNextLogin("False");
         user.setLoginIsDisabled(false);
         user.setPasswordNeverExpires(false);
         user.setThinWorkOrder(false);
         user.setCurrencyTypeId(2);
         return user;
    I am able to fetch the details from Database and display on the page so DAO is working properly hence not copying here
    faces-config.xml
      <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                                  "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
    <managed-bean>
      <managed-bean-name>databaseHandler</managed-bean-name>
      <managed-bean-class>dao.DatabaseHandler</managed-bean-class>
      <managed-bean-scope>application</managed-bean-scope>
    </managed-bean>
    <managed-bean>
      <managed-bean-name>registerFormBean</managed-bean-name>
      <managed-bean-class>services.RegisterFormBean</managed-bean-class>
      <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <navigation-rule>
      <from-view-id>/Register.jsp</from-view-id>
      <navigation-case>
       <from-outcome>success</from-outcome>
       <to-view-id>/Success.jsp</to-view-id>
      </navigation-case>
    </navigation-rule>
    </faces-config>

    A conversion or validation error may have been occurred. Add <h:messages/> to the page to note them all. If you're using at least Sun Mojarra 1.2, then you should be able to note them all in the application server logs.

  • How to call the backing bean method through javascript

    Hi
    I have a command button associated with actionListener . Action Listener method associated with backing bean methods.
    I want to fire the event on command button and backing bean method should be invoked from javascript dynamically.
    can anybody help me asap

    JSF<h:form id="formId">
        <h:commandButton id="buttonId" value="submit" actionListener="#{myBean.action}" />
    </h:form>JSdocument.getElementById('formId:buttonId').click();

  • How to assign and display an attribute value from backing bean?

    Hello all,
    I am using Jdev 11g. I have a form page which has two inputText attributes The first one implements a valueChangeListener feature. When the user enters a value in the first field, a backing bean function will be invoked through the valueChangeListener . In this backing bean function, based on the value in the first field, I want to assign the value to the second field and display it on the page. Can somebody help me how to achieve this?
    Thanks,
    John

    Hi John,
    Here is small example.
    Create two string variables in your backing bean and generate accessors for them.
        private String text;
        private String text1;
        public void setText(String text) {
            this.text = text;
        public String getText() {
            return text;
        public void setText1(String text1) {
            this.text1 = text1;
        public String getText1() {
            return text1;
        }Bind this variables to the value property of the input texts you have. Add the valuechangedlistener for the first input text (and also set autosubmit to true for that item). Also, add the id of the first input text as partial triggers for the second input text. Like,
            <af:inputText label="Label 1"
                          binding="#{backingBeanScope.backing_untitled1.it1}"
                          id="it1"
                          valueChangeListener="#{backingBeanScope.backing_untitled1.textValueChanged}" autoSubmit="true"
                          value="#{backingBeanScope.backing_untitled1.text}"/>
            <af:inputText label="Label 2"
                          binding="#{backingBeanScope.backing_untitled1.it2}"
                          id="it2"
                          value="#{backingBeanScope.backing_untitled1.text1}"
                          partialTriggers="it1"/>Finally, put the logic on your value changed listener. Like,
        public void textValueChanged(ValueChangeEvent vce){
            this.setText1("Hi " + vce.getNewValue());
        }Now, when you run the page and enter your name in the first input text, the second input text will display Hi <your_name>
    HTH.
    -Arun

  • Build a ui component from the backing bean 2

    This is a related question to one I just posted:
    So, I'm trying to build ui components programmatically. In particular, I'm tyring to build af:selectBooleanCheckBox(es), using af:foreach loop. However, to know how many to output I need some information from the database. I query the database in the application module and build an array from the resulting query. I return this array from my method. Now in my backing bean, I want to invoke this method so I can get the array. I'll use tihs array in my jsp page to output the UI component. When I try to instantiate the function in the constructor of my backing bean, I get an error. So I'm planning to use invokeAction to run my method automatically on page load. However, if I do this, how do I get back my array? Where is it stored?
    Also, is it possible to make my array available to my jsp page without going through my backing bean?
    Thanks in advance.

    Hi, it would help if you tell us the jdev version you are using. I assume you use adf rich faces?
    As a general rule, you can't put this kind of code in the constructor.
    I would use a bounded task flow and put call a bean method as default task inside it.
    Timo

  • Backing Bean method not invoked - h:selectOneRadio

    Hi,
    I am trying to invoke a method in the backing bean when a radio button is selected, but for some reasons the method is not getting invoked, any idea why is it so? copying the code for reference.
    I have a command button in this jsp which when clicked is fetching the records(from the backing bean) perfectly and a radio button for each of the record so user can select any one of the records listed.
    example.jsp
    <%@ page language="java" pageEncoding="ISO-8859-1"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
         <base href="<%=basePath%>">
         <title>My Page</title>
         <meta http-equiv="pragma" content="no-cache">
         <meta http-equiv="cache-control" content="no-cache">
         <meta http-equiv="expires" content="0">   
         <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
         <meta http-equiv="description" content="sample List">
         <!--
         <link rel="stylesheet" type="text/css" href="style.css">
         <link rel="stylesheet" href="styleNN.css" type="text/css">
         -->
         </head>
    <body>
         <f:view>
              <h:form id="contacts">
              <table width="200" border="0" title="sample List" style="border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-style: solid" bgcolor="#F0F0F0" cellpadding="2" cellspacing="2">
                   <h:outputLabel value="Product List:" style="font-family: Verdana, Arial, Sans-Serif; font-size: 14px; color: Black; font-weight: bold; font-style: normal; width: 198px" styleClass="bigfieldcell"></h:outputLabel>
                          </table>
              <br>
         <div style="height: 400px; overflow: auto">
                   <h:dataTable border="1" value="#{contactsBean.contactsList}" var="contact" bgcolor="#EEEEEE" frame="box" styleClass="orderlabelcell" cellpadding="3">
                   <h:column>
                             <f:facet name="header">
                                  <h:outputText value="Select to Edit"/>
                             </f:facet>
                                  *<h:selectOneRadio valueChangeListener="#{contactsBean.test}">*
                    *               <f:selectItem itemValue="#{contact}" />*
                *               </h:selectOneRadio>*               </h:column>
                        <h:column>
                             <f:facet name="header">
                                  <h:outputText value="Category"/>
                             </f:facet>
                             <h:inputText value="#{contact.category}" style="border-right-style: none; border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-color: #FFFFFF; border-top-color: #FFFFFF"></h:inputText>
                        </h:column>
                        <h:column>
                             <f:facet name="header">
                                  <h:outputText value="Location"/>
                             </f:facet>
                             <h:outputText value="#{contact.location}"></h:outputText>
                        </h:column>
                        <h:column>
                             <f:facet name="header">
                                  <h:outputText value="Problem Type"/>
                             </f:facet>
                             <h:outputText value="#{contact.problemType}"></h:outputText>
                        </h:column>
                        <h:column>
                             <f:facet name="header">
                                  <h:outputText value="Problem Details"/>
                             </f:facet>
                             <h:outputText value="#{contact.problemDetails}"></h:outputText>
                        </h:column>
                        <h:column>
                             <f:facet name="header">
                                  <h:outputText value="Contact"/>
                             </f:facet>
                             <h:outputText value="#{contact.contact}"></h:outputText>
                        </h:column>
                   </h:dataTable>
                   </div>
                   </h:form>
              </f:view>
    </body>
    </html>
    faces-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                                  "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
    <managed-bean>
      <managed-bean-name>contactsBean</managed-bean-name>
      <managed-bean-class>services.ContactsBean</managed-bean-class>
      <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <managed-bean>
      <managed-bean-name>contactsDatabaseHandler</managed-bean-name>
      <managed-bean-class>dao.ContactsDatabaseHandler</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    </faces-config>
    ContactsBean.java
    package services;
    import java.util.ArrayList;
    import java.util.Hashtable;
    import java.util.List;
    import javax.faces.context.FacesContext;
    import javax.faces.event.AbortProcessingException;
    import javax.faces.event.ValueChangeEvent;
    import javax.faces.model.SelectItem;
    import sun.security.action.GetLongAction;
    import dao.ContactsDatabaseHandler;
    import model.Contact;
    public class ContactsBean {
         private String selectedLocation;
         private List locationList;
         private String selectedProblemType;
         private List problemTypeList;
         private List contactsList;
         private ContactsDatabaseHandler dbHandler;
         private String address;
         private Hashtable region;
         private Contact selectedContact;
         public void test(ValueChangeEvent event)throws AbortProcessingException {
              System.out.println("In Backing Bean : test method.... ");
    }Thanks in Advance

    The valueChangeListener runs at the server side. You need to submit the form to the server side to invoke the valueChangeListener. There is no client side magic like Javascript.
    To submit the parent form on change of the dropdown, just add the following attribute with a piece of Javascript to the h:selectOneMenu:onchange="this.form.submit()"

  • Problem while invoking popup from backing bean

    I am invoking a popup from backing bean method.
    The same backing bean method has the business logic which depends on the data collected from popup(user enters some data on popup).
    So I need the business logic to be executed after popup comes up.
    The popup is coming after the execution of return statement in backing bean method . How do i make popup trigger at earlier point in the method.
    <af:commandToolbarButton text="#{corePostupgradeuiBundle.SIGN_OFF_MIG}"
    id="socb52"
    partialSubmit="true"
    actionListener="#{viewScope.signoffBean.signOffAgents}"
    partialTriggers="t3"/>
    public void signOffAgents(ActionEvent event) throws SQLException {
    DCBindingContainer bc =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding summaryIter =
    bc.findIteratorBinding("Signoff1Iterator");
    showPopup("credentials"); //will get credential details from user and store in credential Bean
    //Following logic uses the data collected from popup
    EMCredentialReference credRef= credentialBean.getCredReference();
    submitJOb(credRef);
    public static void showPopup(String popupId) {
    FacesContext context = FacesContext.getCurrentInstance();
    StringBuilder script = new StringBuilder();
    script.append("AdfPage.PAGE.findComponent(\"").append(popupId).append("\").show();");
    ExtendedRenderKitService erks =
    Service.getService(context.getRenderKit(),
    ExtendedRenderKitService.class);
    erks.addScript(context, script.toString());
    UIComponent component = context.getViewRoot().findComponent(popupId);
    RequestContext.getCurrentInstance().addPartialTarget(component);
    }

    Well, your work flow is wrong.
    What you try to accomplish should work out of the box as
    1) user hit toolbar button
    2) this opens a popup "credentials" which have listeners for ok and cancel
    3) use fills in data in popup and hit ok or cancel
    4) one of the listeners gets fired
    5a) if OK listener you do your business logic
    5b) if cancel you do something else
    So all you have to do is the use a af:af:showPopupBehavioron the toolbar button, add a popup canel listener (if you need to act on canel) dependign on your popup design (dialog or simple button) add the appropriate listeners and in the listener method so your business logic.
    Timo

  • Invoke task flow from backing bean?

    Hi,
    Is there a way to invoke task flow from a backing bean? If yes, how?
    Thanks in advance

    Thanks Frank. I am not an expert with ADF so please bear with me if my questions doesn't make sense. Basically what I am trying to achieve is this.
    I have a taskflow and I am currently in a ui page which displays a page fragment inside this task flow. In this page, on click of a button, I need to call another task flow and show it in a adf popup. Is this the case referred in the pdf document that you pointed out?
    Thanks

  • ValueChangeListener not invoking backing bean method

    Hi Everybody
    I am using a valueChangeListener attribute with <h:selectOneListbox>. As i am using onChange, the form is getting submitted but the associated backing bean method is not getting invoked.
    My JSP code:
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <html>
       <head>
          <title>Song Detail</title>
       </head>
       <body>
          <f:view>   
               <h:form id="songForm">
                       <H4>Select a song to view detail.</H4>
                </Br>
                       <h:selectOneListbox id="songList" value="#{songBean.selectedSong}"
    valueChangeListener="#{songBean.songInformation}" immediate="true" onchange="submit();">
                              <f:selectItems value="#{songBean.songList}"/>
                     </h:selectOneListbox>
                <p>
                 <h:outputText id="result" value="#{songBean.songDetail}"/>
             </p>   
         </h:form>                  
       </f:view>
      </body>
    </html> My Backing bean method:
    public void songInformation(ValueChangeEvent vce) throws AbortProcessingException
              System.out.println("Method invoked");
           } This songInformation() method is not getting invoked.
    Please help.

    I never say to put every bean in session scope.
    I recommend that the following beans are in session scope:
    (1) the value property of h:dataTable
    (2) the value property of f:selectItems
    (3) the rendered property
    They are evaluated before Update Model Values phase.

  • How to pass parameter onclick of a command link created in a managed bean

    Hi,
    I created a command link in a managed bean using RichCommandLink . I want to pass a parameter on click of the command link like we do using <f:attribute> on the jspx. As i have created a command link using the bean hence i want to pass it programmatically to another method . How should i pass the parameter via the command link. Please help..

    Hi,
    can you please elaborate more on this.
    i am not getting what you are trying to tell.
    following is my actual code in java bean : :
    RichCommandLink remove= new RichCommandLink();
    remove.setId("E"+(rowID-1));
    remove.setText("Remove");
    FacesContext context = FacesContext.getCurrentInstance();
    MethodExpression actionListener = context.getApplication().getExpressionFactory().createMethodExpression(context.getELContext(), "#{viewScope.test.onRemove}", null, new Class[] {ActionEvent.class});
    remove.addActionListener(new MethodExpressionActionListener(actionListener));
    childrenOfGroupLayout.add(remove);
    Here i have created RichCommandLink in Bean, in this i want to add the <f:attribute>
    how to add this in my current component.
    can you give some example..
    please help..

  • Invoke Edit action once I click on Command Link,,,,,, Help me out in

    Hi
    I am having a datatable , which consists of of ROWS, & Columns
    when I click on that command link, it shoud open a property page with all the bean data populated,,,, "I am using the same Add property page for edit also", Now I am modifying the data and click on "Add", Now It should call[b] UpdateQuery ie, ModifyServiceDomain instead of Insert Query "Add ServiceDomain".., Tell me how to do that...
    How to solve the above problem..
    Java Class:
    public class ServiceDomainEventHandler {
        * This method is used to modify a service domain from the Web UI.
        * @return "succuess", if a service domain can be modified successfully,
        *         "failure", if a service domain can not be modified
       public String modifyServiceDomain()
          log.debug( "Into modifyServiceDomain method" );
          String returnStr = "edit_SD";
          FacesContext facesContext = FacesContext.getCurrentInstance();
          ExternalContext externalContext = facesContext.getExternalContext();
          HttpServletRequest request = (HttpServletRequest) externalContext
                .getRequest();
          String serviceDomainName = (String) request
                .getParameter( "serviceDomainName" );
          ServiceDomain servicedomain = null;
          try
             servicedomain = new ServiceDomainDbAccess()
                   .getServiceDomainByName( UIConstants.WHICH_DB,
                         serviceDomainName );
          catch (SQLException pe)
             pe.printStackTrace();
          try
             servicedomain = new ServiceDomainMgerImpl().getServiceDomainById(
                   UIConstants.WHICH_DB, Integer.parseInt( servicedomain
                         .getId() ) );
             if (servicedomain != null)
                facesContext.getExternalContext().getRequestMap().put(
                      "ServiceDomain", servicedomain );
             else
                log.debug( "Unable to obtain the ServiceDomain!" );
          catch (NrsProvisionException pe)
             returnStr = "failure";
             handleUIErrors( facesContext, pe );
          log.debug( "modifyServiceDomain method return value: " + returnStr );
          return returnStr;
        * This method is used to add a service domain from the Web UI.
        * @return "succuess", if a service domain can be added successfully,
        *         "failure", if a service domain can not be added
       public String addServiceDomain()
          log.debug( "Into addServiceDomain method" );
          String returnStr = "success";
          FacesContext facesContext = FacesContext.getCurrentInstance();
          ExternalContext externalContext = facesContext.getExternalContext();
          Map requestMap = externalContext.getRequestMap();
          ServiceDomain curServiceDomain = (ServiceDomain) requestMap
                .get( "ServiceDomain" );
          try
             new ServiceDomainMgerImpl().addServiceDomain( curServiceDomain );
          catch (NrsProvisionException pe)
             returnStr = "failure";
             handleUIErrors( facesContext, pe );
          log.debug( "addServiceDomain method return value: " + returnStr );
          return returnStr;
    Jsp Page:
    <%@ page language="java" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <f:view>
         <f:loadBundle basename="com.nortel.ems.mgmt.nrsm.messages.ServiceDomainMessageBundle" var="bundle"/>
         <%
              String path = request.getContextPath();
              String basePath =
              request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
         %>
         <html>
              <head>
                   <base href="<%=basePath%>">
                   <link REL="stylesheet" TYPE="text/css" HREF="<%= request.getContextPath()%>/css/nrsStyle.css">
                   <title>Service Domain add page</title>
              </head>      
              <body>
              <f:verbatim>
              <div
                   style="height:500px;overflow: scroll; margin-top: -2px;margin-bottom: -2px;border: 1px solid #CCCCCC; border-top:none;width:100%">
         </f:verbatim>
                   <h:panelGroup id="SDPanel" styleClass="panelGroup">
                        <h:form id="SDForm" >                    
                             <h:panelGroup id="SDSubPanel" >
                               <h:panelGrid id="SDPanelGrid" styleClass="panelGrid"
                                              columnClasses="panelGridCol1,panelGridCol2,panelGridCol3,panelGridCol4"
                                            headerClass="tableHeaders" columns="4">   
                                    <f:facet name="header">     
                                         <h:outputText id="SDHead" value="#{bundle.serviceDomainAdd}"/>   
                                    </f:facet>                                                
                                  <h:message for="SDForm" styleClass="fieldErrors" />
                                  <h:outputText id="BlankCol1" value=""/>                                 
                                  <h:outputText id="BlankCol2" value=""/>                                 
                                  <h:outputText id="BlankCol3" value=""/>                                                               
                                    <h:outputText id="SDName" value="#{bundle.serviceDomainName}"/>
                                    <h:inputText id="name" value="#{ServiceDomain.name}" />
                                  <h:outputText id="Mandatory" value="*"/>                                 
                                    <h:message for="name" styleClass="fieldErrors" />
                                    <h:outputText id="SDDesc" value="#{bundle.serviceDomainDesc}"/>
                                    <h:inputTextarea id="description" value="#{ServiceDomain.description}" />   
                                  <h:outputText id="BlankCol4" value=""/>                                 
                                    <h:message for="description" styleClass="fieldErrors" />
                               </h:panelGrid>            
                             </h:panelGroup>
                   <h:panelGroup styleClass="buttonpanelright">
                        <h:commandButton id="AddSD" action="#{ServiceDomainEventHandler.addServiceDomain}" value="#{bundle.serviceDomainSave}"/>
                             <h:commandButton id="CancelSD" action="#{ServiceDomainEventHandler.cancel}" value="#{bundle.serviceDomainCancel}" />
                   </h:panelGroup>
              </h:form>
         </h:panelGroup>
         <h:outputText id="SDMandatoryIndicator" styleClass="mandatory" value="#{bundle.mandatory}"/>
         <f:verbatim>
              </div>
         </f:verbatim>
         </body>
         </html>
    </f:view>[code[/code]]

    update your adobe reader here, http://get.adobe.com/reader/
    untick unwanted tag-along ware.

  • ***How to Invoke backing bean method by DOUBLE-CLICK the table ROW!!***

    Hi,
    How can I collect the selected row value & navigate to next page by DOUBLE-CLICK the result table row.
    My application got searchResult page where I am displaying the list of user in result table. Then selecting any one row and navigating to master details page by clicking the continue button. Button Action method will collect the selected row userID which I am forwarding to the masterDetails page.
    Same functionality I want to do by double click the row instead of clicking the button!!. I want to trigger the backing bean method if the user double click the row basically. Please help me in this how to do this?
    Current button action method:
    *public String userSelected() {*
    FacesCtrlHierNodeBinding binding = (FacesCtrlHierNodeBinding) searchResultTable.getSelectedRowData();
    currentRow = binding.getRow();
    selectedNetID = (String) currentRow.getAttribute("netid");
    System.out.println("selectedNetID -->"+selectedNetID);
    requestContext.getPageFlowScope().put("netid",selectedNetID);
    return "continue";
    *}*

    Puthanampatti ,
    Yes, I am using the same. Below is my code. I am trying to get the object of the MAIN jspx page region (where I am displaying the fragments) and refresh the one. But cant able to get the object for the region it is returning null. without refresh seems the navigation wont work.
    public void doDbClick(ClientEvent clientEvent) {
    FacesCtrlHierNodeBinding binding = (FacesCtrlHierNodeBinding) searchResultTable.getSelectedRowData();
    currentRow = binding.getRow();
    selectedNetID = (String) currentRow.getAttribute("netid");
    System.out.println("selectedNetID -->"+selectedNetID);
    requestContext.getPageFlowScope().put("netid",selectedNetID);
    try{
    FacesContext facesCtx = FacesContext.getCurrentInstance();
    NavigationHandler nh = facesCtx.getApplication().getNavigationHandler();
    nh.handleNavigation(facesCtx, "", "continue");
    System.out.println("region obj -->" +facesCtx.getViewRoot().findComponent("advse1"));
    // Refresh the current region; advse1 is the id of the region component inside jspx page
    AdfFacesContext.getCurrentInstance().addPartialTarget(facesCtx.getViewRoot().findComponent("advse1"));
    catch(Exception e){
    System.out.println("Error is: " +e);
    Is this correct coding to get the region object?? actually the "result table" and "Master details" are 2 different fragments which are linked with task-flow and the task flow is part of main jspx page as a region. I am using that region ID to get the obj, but cant able to get so....!!! any idea

  • Invoke bpel from ADF Backing Bean

    Hi,
    I have a requirement of invoking a bpel process developed with SOA 11g Suite from a ADF Backing Bean in Jdeveloper 10g. Can someone provide me with code samples?
    I have reference for invoking bpel process from standalone java client in Jdeveloper 11g, but landing up getting exceptions.
    This is critical and any help is appreciated!

    Hi,
    Thanks. This is the code used. I'm trying to invoke a bpel created in SOA suite 11g using a stand alone java client in Jdeveloper 10.1.3.3.0.4147.
    public static void main(String args[]) throws Exception {
    Hashtable jndiProps = new Hashtable();
    jndiProps.put(Context.PROVIDER_URL,
    "url");
    jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    jndiProps.put(Context.SECURITY_PRINCIPAL,"weblogic");
    jndiProps.put(Context.SECURITY_CREDENTIALS,"pwd");
    jndiProps.put("dedicated.connection","true");
    Locator locator = LocatorFactory.createLocator(jndiProps);
    String inputPayload = getDOM();
    String compositeDN="default/myprocess!1.0";
    Composite composite = locator.lookupComposite(compositeDN);
    System.out.println("getting the dn "+composite.getDN());
    String serviceName="myprocess";
    Service deliveryService = composite.getService(serviceName);
    // construct the normalized message and send to Oracle WLS
    NormalizedMessage nm = new NormalizedMessageImpl();
    nm.getPayload().put("payload", inputPayload );
    NormalizedMessage res = null;
    try
    res = deliveryService.request("initiate", nm);
    catch(Exception e)
    e.printStackTrace();
    System.out.println("updated");
    public static String getDOM() {
    StringBuffer res = new StringBuffer();
    String requestXml="";
    try{                       
    InputStream is = new BufferedInputStream(
    new FileInputStream("D:\\test.xml"));
    int c;
    while ((c = is.read())!= -1 ){
    res.append((char)c);
    }catch(Exception e){
    e.printStackTrace();
    return res.toString();
    This line res = deliveryService.request("initiate", nm);
    ends up getting the following exception.
    java.rmi.RemoteException: EJB Exception: ; nested exception is:
    java.lang.RuntimeException: oracle.fabric.common.FabricInvocationException
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234)
    at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:223)
    at oracle.soa.management.internal.ejb.impl.FacadeFinderBean_4vacyo_FacadeFinderBeanImpl_1032_WLStub.executeServiceMethod(Unknown Source)
    at oracle.soa.management.internal.ejb.EJBLocatorImpl.executeServiceMethod(EJBLocatorImpl.java:916)
    at oracle.soa.management.internal.facade.ServiceImpl.request(ServiceImpl.java:118)
    at invokebpelprocess.InvokeBpel.main(InvokeBpel.java:74)
    The following jars are included.
    Soa-infra-mgmt.jar
    weblogic.jar
    wsclient.jar
    wsclient-extended.jar
    wlfullclient.jar
    fabric-common.jar
    fabric-runtime.jar
    Edited by: user10291345 on Oct 26, 2010 2:09 AM

  • About backing bean method's invokation

    Hi,
    I have a backing bean method binded to a component:
    <af:selectOneChoice value="#{bindings.managerId.inputValue}"
    label="Manager" valign="middle"
    binding="#{backing_searchDocuments.managersList}"
    valuePassThru="true" immediate="false"
    rendered="#{bindings.ListManagersIterator.estimatedRowCount > 1}">
    <f:selectItems value="#{bindings.managerId.items}"/>
    When page refreshes component executes his binding method. But in some cases, actually when I press the commandMenuItem leading to the same page where I am it seems that it doesn't get invoked.. how can I manage the invocation of backing bean's methods? I need it invoked every time any request is made.. How to do that?

    Mario,
    this method is executed when the component re-draws. So anything other than a PPR request makes this binding method being called.
    If PPR is used with your commandMenuItem, them make sure the PPR trigger is set to refresh the component.
    I don't know what code it is that you need to execute each time, but maybe putting this on a action listener is a better idea
    Frank

Maybe you are looking for

  • Lost recovery key

    I reformatted my drive because of virus, and I did not copy the whole c drive other than files i need. I thought the firefox sync will let me restore all my bookmarks and tabs after I had my computer backup and running again! Obviously i was wrong be

  • Error importing a biar file in edge 3.0

    I can create the biar file, but when i go to import it i get this error message 'Failed to open the BIAR file. Reason: com.businessobjects.sdk.biar.om.internal.iw.ObjectManagerIWException:Input/Output exception occurred:'Couldn't find entry 'Business

  • Gives me errors when preview report in world.

    Hi Members, below is the errors when i try to run and preview report in world. any help and suggestion is greatly appriciated. ConfFile: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\config\xdoconfig.xml Font Dir

  • Hi Experts, Crystal report mutiple value selection using checkbox in 8.81

    Hi, I am using Crystal report multiple value selection option using checkbox in 8.81 sap b1 pl 05.but i want default all check box value should be selected. How do we achieve same. Thanks Rajkumar Gupta Edited by: Rajkumar Gupta on Jul 11, 2011 5:45

  • Item level tabstrip to me51n and me54n

    Hi,    I need to add a tab strip at item level for tcode ME51N and ME54N.    This tab will contain 1 field which will show stock info    Kindly let me know if there is any badi existing for the same along with the procedure. Thanks in advance Ajay