Backing bean not holding values!

I have created a simple login page for an app I am creating. I have used JSPX, and created a backing bean which is registered as a managed bean. Just for interests sake (to check that things work), i initialise the userName and password attributes - and I see these defualt values in the gui (OK), however when I entered a user name and password, the values are not updated, so my login code (bound to the action of a commandButton) cannot get the values and log me in.
my faces-config.xml has this snippet:
<managed-bean>
<managed-bean-name>LoginBean</managed-bean-name>
<managed-bean-class>userinterface.backing.LoginBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
my JSPX has definitions like this:
<h:inputText id="userName" value="#{LoginBean.userName}" required="true"/>
my backing bean has the attributes defined:
private String password = "testPass";
private String userName = "testUser";
i just dont understand what I am missing. From the documentation I have read, setting the value attribute by binding it the the backing beans attributes should be enough to update the values... but apparently not.
Also, when I press "login" the username and password fields are cleared... is this normal behviour?
I am sure my backing bean is correctly defined as the fields show with default values, and the command buttons worrk. Do I need to hook up the getters and setters in the JSPX page?
Thanks for any insight - this is fun technology to play with, but trying to get some simple things up and running can be frustrating!
/caj

I found the problem eventually - the structure in my jspx document was incorrect, as I had mananged to split my from into two forms, and the submit commandButton was only submitting the form that the button resided on. The edited information was on the other form, and was thus not sumbitted. Once I merged the form into one, the whole thing worked perfectly!!
I figured that I did something wrong - hope this mistake can help others.
/caj

Similar Messages

  • Clearing up a backing bean's property values.

    Hi All
    I saw a few similar posts from the past on this forum similar to my issue but couldnt make much sense of them. Therefore appologies for any repetition :)
    I have search jsp/jsf page. And have one session scope backing bean associated with it. There is a cancel/Back button on the jsp page that takes the current user back to the previous page.
    The problem is that if the user entered some search criteria in the UI components that criteria is retained in my backing bean when the user revists the page. I want my bean's properties to be cleared up once the user leaves the page.
    I would prefer not to set the scope of my backing bean to request.
    One solution i can think of is to set all the properties to null before leaving the page. (I have not tried it yet as I am actually posting from home after coming back from work :) )
    Could you guys advise any more elegant solutions that could possibly solve this issue?
    many thanks

    Set the beans propertie values to null in the constructor [If it is in pagecode]
    and in the jsp use binding
    Like for example:in the constructor of the pagecode
    public Some(){
    if((getFacesContext().getExternalContext().getRequestParameterMap().isEmpty()) || (getFacesContext().getExternalContext().getRequestParameterMap().containsKey("parkPlanFrm:prePlanName"))){
    ValueBinding vb = getFacesContext().getApplication().createValueBinding("#{bean}");
    Bean pcBean = new Bean()
    pcBean = (Bean)vb.getValue(getFacesContext());
    pcBean.getParkPlanCountyMenu().setSubmittedValue("select");
    pcBean.getParkPlanCountyMenu().setValue(null);
    vb.setValue(getFacesContext(), pcBean);               
    IN THE JSP:
    <h:inputText id="parkPlanPpn" styleClass="inputText" maxlength="15" size="15"
    value="#{bean.prePlanNumber}" binding="#{bean.parkPlanPpn}" size="15">
    </h:inputText>
    Here *value="#{bean.prePlanNumber}"* is from the Managed Bean
    *binding="#{bean.parkPlanPpn}"* is from PageCode
    Ravi

  • BW Status field does not hold value

    Hi experts,
                        in 0CRM_SRV_PROCESS_H data source Status field doesn't come that's why I enhanced the
    data source with a new field in CRM system by creating new BW Status objects. But, when i tried extracting
    data, BW Status is holding value for only few records. We have checked the transactions & the status object
    declaration but not able to find the reason why only 2/3 records giving status.Please help me in this regard if
    anybody has worked on similar problem.  
    Regards,
    Priyanka Joshi

    Hi Hemanth,
                           Source system has data. I have no idea about the exit written by the system internally but I
    have not written any EXIT to put Status field value into my BWSTATUS field.I have created BW Status object
    in SBIW transaction --> user status in CRM system. Generally this is the method to map Status field value for
    BW Data sources, I have used it already but this time its not working for all records.
    Regards,
    Priyanka Joshi

  • I_vnam does not hold value after i_step is 1

    Hi all!
    I have a characteristic 0calday. For my report, i have a customer exit which has the following requirement:
    If only one value is entered for 0calday, I have to populate this value as 'From' value for 0calday and system date should be in the 'To' value of 0calday so as get data for the range value entered and current date.
    I tried  using the following code:
    CASE i_vnam.
    WHEN 'ZC_CADAT'.
    CASE i_step.
       WHEN 3.
         READ TABLE I_T_VAR_RANGE INTO L_S_VARIABLE_RANGE INDEX 2.
           IF SY-SUBRC = 0.
             IF L_S_VARIABLE_RANGE-LOW IS NOT INITIAL
             AND L_S_VARIABLE_RANGE-HIGH IS INITIAL.
                l_s_range-sign = 'I'.
                l_s_range-opt  = 'BT'.
                L_S_RANGE-LOW  = L_S_VARIABLE_RANGE-LOW.
                l_s_range-high = SY-DATUM.
                APPEND l_s_range TO e_t_range.
             ENDIF.
           ENDIF.
      ENDCASE.
    ENDCASE.
    When I was debugging this is what i found:
    I_VNAM holds ZC_CADAT initially untill i_step =1.
    the variable screen appears and I 've entered only one value for variable ZC_CADAT.
    Execution was fine till here. after my input,
    Ideally, I_VNAM should hold the value ZC_CADAT, and I_STEP should be 2.
    But both of them are not working. Both I_Vnam does not hold ZC_CADAT and I_Step is now 3.
    Please help me. I am unable to work this out.
    Points will be awarded!!!
    Thanks,
    Sri

    Hi,
    I was using a different customer exit variable to capture the input and pass that value to other CE variable with i_step = 2.
    This solved it.
    If this was not ur case, let me know the problem background
    Thanks
    Sri

  • Popup from backing bean not using facesContext.addMessage()

    I am creating a popup from backing bean as:
    FacesContext facesContext = FacesContext.getCurrentInstance();
    FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, null, "some message");
    facesContext.addMessage();
    I want the code after the popup creation to execute after the user clicks "ok" on the popup. But somehow the code after these lines gets executed first & then the popup appears after the control returns from the backing bean. Looks like the popup creation happens in a completely different thread. Is there a way to show the popup immediately where I want instead of this facesContext.addMessage() method where execution can wait for the user action?

    yeah, you can create a component declarative or popup that shows the message personalized, and call with javascript , see my others posts
    Re: Component Poppup declarative - problems with multiple instances
    this functional now with jdev 11.1.1.3.
    Regards
    joaquin

  • How can I receive the value of a selected item in the backing bean

    I have a table in a jspx file.
    When I go to the detail page I want to do something with the value of the currentrow.
    I want do a calculaction of the value of ClbId.
    How can I receive the value of the selected ClbId in my backing bean
    <af:table value="#{bindings.Searchteamlist.collectionModel}"
    var="row" rows="#{bindings.Searchteamlist.rangeSize}"
    first="#{bindings.Searchteamlist.rangeStart}"
    emptyText="#{bindings.Searchteamlist.viewable ? 'No rows yet.' : 'Access Denied.'}"
    selectionState="#{bindings.Searchteamlist.collectionModel.selectedRow}"
    selectionListener="#{bindings.Searchteamlist.collectionModel.makeCurrent}"
    rendered="#{backing_FirstFlag_Club_Club.searchFirstTimeClub_Club_AdresAndereClubs == false}">
    <af:column sortProperty="Matricule" sortable="true"
    headerText="#{bindings.Searchteamlist.labels.Matricule}">
    <af:outputText value="#{row.Matricule}"/>
    </af:column>
    <af:column sortProperty="ClbId" sortable="true"
    headerText="#{bindings.Searchteamlist.labels.ClbId}">
    <af:outputText value="#{row.ClbId}">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.Searchteamlist.formats.ClbId}"/>
    </af:outputText>
    </af:column>
    <af:column sortProperty="Nom" sortable="true"
    headerText="#{bindings.Searchteamlist.labels.Nom}">
    <af:outputText value="#{row.Nom}"/>
    </af:column>
    <f:facet name="selection">
    <af:tableSelectOne text="Select and">
    <af:commandButton text="Submit"
    action="club_AdresAndereClubsDetail">
    <af:setActionListener from="#{row}"
    to="#{processScope.row}"/>
    </af:commandButton>
    </af:tableSelectOne>
    </f:facet>
    </af:table>

    hi tde
    Using an Expression Language helper class like this one from Steve Muench ...
    http://radio.weblogs.com/0118231/stories/2006/12/18/sourceForMyFavoriteElHelperClass.html
    ... you could write something like this in your backing bean:
    Integer vClbId = (Integer)EL.get("#{row.ClbId}");(Make sure to cast it to the correct type.)
    success
    Jan Vervecken

  • JSF Backing Bean State Being Lost Prior to Submit

    ISSUE
    I have an attribute in a backing bean for a drop-down list in a JSF that loses its state before I submit the page, which causes data updates to the backing bean dependent upon its state to be ignored.
    CONTEXT
    The JSF in question has a selectOneMenu drop-down list that determines whether or not several inputText fields will be rendered. The selectOneMenu is bound to an enum in the backing bean, and there are conditional accessors allowing the JSF to determine which inputTexts should be included in the current view. The three valid values of the drop-down are "ALL", "RANGE" and "SINGLE". The page is request scoped, a requirement of this project.
    Here is the JSF tag for the selectOneMenu drop-down list:
    <h:selectOneMenu disabled="#{not backingBean.newEntry}"
        id="tCriteria"
        value="#{backingBean.tCriteria}"
        onchange="submit()">
        <f:selectItems value="#{backingBean.possibleTCriteria}" />
    </h:selectOneMenu>And here are the RANGE selection-specific inputText controls:
    <h:inputText disabled="#{not backingBean.newEntry}"
        rendered="#{backingBean.tRange}"
        id="startTIndex"
        value="#{backingBean.tIndex}" />
    <h:inputText disabled="#{not backingBean.newEntry}"
        rendered="#{backingBean.tRange}"
        id="endTIndex"
        value="#{backingBean.endTIndex}" />Here is how I initialize the backing bean for the drop-down list attribute:
    * The current "t" criteria.
    private TCriteria tCriteria = TCriteria.ALL;And there are basic accessor/mutator methods for it. All of this works pretty well, with one problem. If I select "RANGE" in the drop-down, the appropriate inputText fields appear in the view. When I submit the page with values in the inputText fields, the value of the drop-down in the backing bean has been reset to its default initial value ("ALL") without having been updated through its mutator. Thus, when values in the backing bean are updated from the JSF, the conditional inputText fields are ignored, as they appear to have been deemed irrelevant during the update phase by the invalid state of the backing bean for the drop-down.
    To test my theory, I changed the default value of the backing bean attribute for the drop-down to be "RANGE", and made it final. The page behaves perfectly in updating the backing bean with the values entered for the conditionally-displayed inputText controls. This tells me that the invalid state of the backing bean drop-down list attribute must be the problem. Furthermore, I have tried using "disabled=", "readonly=" and "rendered=" on the conditional inputText fields, and none of that seems to make a difference. I also tried using a ValueChangeHandler, but that didn't do anything about it.
    Note - the backing bean does realize that the correct state for the drop-down should be "RANGE", but only AFTER the backing bean has received its updated values from the page controls.
    Has anyone seen anything like this? I haven't read anything in previous posts about an issue like this, but it has to be something someone has seen before. Maybe related to using the enum type? Thanks.

    Hi,
    did your web.xml file had any parameter regarding explicitly indicating the way to save state?
    I mean something like
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
      </context-param>One last question: did you stay with request scope beans or session ones?
    Greetings.
    MogaRick

  • Differences between servlet and backing bean

    Could anyone please tell me whether everywhere that servlet can be used, backing bean and JSF can be used too? Are JSF and backing beans the new alternatives for JSP and servlets? please clarify the relations between these concepts for me.
    Thanks
    Laura

    Laura_Jlover wrote:
    Thank you. You mean backing beans can do every thing that servlets can do? Yes.
    JSF pages can work with servlets? Strictly speaking, every JSF page gets passed through the FacesServlet which does all the task. The lifecycle, creating the FacesContext, putting the request parameters in backing beans, rendering the response, etcetera.
    what are the advantages of servlet and the advantages of backing beans? what's the disadvantages? In general, which one is better?In context of JSF, you should be using backing beans, not Servlets. There is nothing what a Servlet can offer you as an advantage in the JSF context. It is simply not an option/alternative. You can't even call a Servlet (directly) using a JSF h:form. You, however, can access backing beans in any JSP or Servlet outside the JSF context.
    Just carefully read the JSF specification or buy a JSF book and the picture will be clear.
    JSF spec: [http://jcp.org/aboutJava/communityprocess/final/jsr252/index.html].
    JSF book: [http://www.amazon.com/JavaServer-Faces-Complete-Reference/dp/0072262400].

  • H:inputText and immediate="true" not updating cached backing bean value

    Hi,
    I am having a problem with h:inputText and immediate="true" when
    returning back to the same page.I looked through the forums but the
    only solution to remove the page from the session works only if I
    don't have to change any button label names in the page I am going back
    to.Unfortunately, I have to change a button name when I go back to the
    same page.The button name change works if i don't remove the page from
    session but then h:inputtext has stale values in it from the backing
    bean.I also need to avoid validation as it is a huge form.
    I have tried looking through the JSF forums but they didn't have any
    answers for a very similar question.
    I am not sure how exactly to use component binding for the input text and update the model values using an actionListener.I have tried puting a binding on an input text field and then used an actionListener instead of immediate="true' in the h:commandLink.But, putting context.renderResponse() in the actionListener method results in the model values not getting updated.
    I have also tried using component.processUpdates(facesContext) as in the UpdateModelValuePhase class -that too doesn't work.
    Thanks for any help,
    Vijay
    Details:
    The <h:inputText ..> does not populate the values back from a backing
    bean when immediate="true" is used when an action is called.
    <h:commandLink id="selectPrincipalId"
    action="#{application.selectPrincipal}" immediate="true">
    Only <h:inputText has the cached values from the first entry.
    <h:inputText id="principalLastName1Id"
    value="#{application.currentPrincipal.lastName}" size="10"/><== this
    has the cached value from the backing bean application.
    <h:outputText gets the new values from the backing bean when the same
    page is reentered.
    <h:outputText value="#{application.currentPrincipal.lastName}"></h:outputText><==
    this refreshes with the new value from the backing bean application.
    Here is the solution to rectify the problem:
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExternalContext externalContext = facesContext.getExternalContext();
    Map sessionMap = externalContext.getSessionMap();
    sessionMap.remove("/jsp/befg/tc/apply/enterCreditApplication.jsp");
    <== this is the name of the jsf page as defined in the
    faces-config.xml.

    Hi,I have encountered the same problem as you,and I find a solution myself,which is shown as follows,but I don't know if these is any hidden trouble in the code.
    <h:form>
    <h:commandLink action="#{app.action}" immediate="true" actionListener="#{app.update}">xxxx</h:commandLink>
    <h:inputText id="_id" value="#{app.val}" immediate="true"/> //must set immediate="true" else the model will be not updated
    <h:message for="_id"/>
    </h:form>
    public class App{
    public void update(ActionEvent event){
         FacesContext c = FacesContext.getCurrentInstance();
         UIViewRoot root =c.getViewRoot();
         root.processUpdates(c);//to update model and short-circuit the validators
    in such circumstance,the UIViewRoot's processUpdates method will be called in the actionlistener,and the back bean who titled to immediate(true)'s inputText will be updated, but the one who titled to immdiate(false)'s inputText will not be updated,Why?
    Can anyone tell me way?and how to solve?
    Thanks a lot!

  • UI Component (h:selectOneMenu) showing old value not matching backing bean

    Mojarra 2.1.7-jbossorg-1
    I'm out of my wits trying to figure out what is going on here.
    I have broken down the problem that I am seeing to something smaller test case that is easily reproducable.
    Two <h:selectOneRadio> ( Approved and Notified )
    One <h:selectOneMenu> wrapped in a <h:panelGroup>
    One <h:commandButton>
    The list of contents of the <h:selectOneMenu> is dependent on the value of the "Approved" <h:selectOneRadio>, and the list is obtained from the viewBean.
    Apart from the "required" attribute, the only other validation is a validator method in the bean that:
    If "Approved" radio button is Yes, and "Notified" radio button is No, then a ValidatorException is thrown and is shown on the <h:messages>
    Now the issue:
    1) Select Approved "Yes"
    2) Select Notified "No"
    3) Select dropdown to PEND
    4) Select Submit button
    5) <h:messages> show "Notified must be true when action is PEND". All good.
    6) Change Approved to "No" ... Note that there is a listener on change of Approved ... and the listener will always set the value of the dropdown to null.
    Because I changed the value of the Approved radio button, the dropdown selection is then changed to the "- Select- " item, which is what I am expecting as that is what the listener method does ... and the dropdown is re-rendered.
    7) Change Approved back to "Yes" ... dropdown changes back to PEND ... This is what I do not understand.
    Why was it being changed back to PEND when:
    A) The listener on the Approved radio button always sets the value of the dropdown to null in the backend.. and
    B) The Approved render attribute always re-render the dropdown
    <!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:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head></h:head>
    <body>
    <h:form>
           <h:outputLabel value="Approved:"/>
           <h:selectOneRadio id="approved" value="#{viewBean.approved}"
                required="true"
                requiredMessage="Approved is required.">
                <f:selectItem itemValue="true" itemLabel="Yes"/>
                <f:selectItem itemValue="false" itemLabel="No"/>
                <f:ajax
                    event="valueChange"
                    execute="@this"
                    render="nextActionPanel"
                    listener="#{viewBean.triggerApprovedChange()}"/>
           </h:selectOneRadio>
           <h:outputLabel value="Notified:"/>
           <h:selectOneRadio id="notified" value="#{viewBean.notified}"
                required="true"
                requiredMessage="Notified is required."
                   validator="#{viewBean.validateNotified}">
                <f:selectItem itemValue="true" itemLabel="Yes"/>
                <f:selectItem itemValue="false" itemLabel="No"/>
                <f:ajax
                    event="valueChange"
                    execute="@this"
                    render="@none"/>
           </h:selectOneRadio>
            <h:panelGroup id="nextActionPanel">
           <h:selectOneMenu id="nextAction"
                 required="true"
                 requiredMessage="Next Action is required."
                 value="#{viewBean.nextAction}">
                 <f:selectItem itemValue="" itemLabel="- Select -" />
                 <f:selectItems
                     value="#{viewBean.availableNextActions}" var="target"
                     itemValue="#{target.value}"
                     itemLabel="#{target.label}"/>
                   <f:ajax
                    event="valueChange"
                    execute="@this"
                    render="@none"/>
           </h:selectOneMenu>
            </h:panelGroup>
           <h:commandButton id="submit" value="Submit"/><br/>
           <h:messages/>
    </h:form>
    </body>
    </html>
    package test;
    import java.io.Serializable;
    import java.util.ArrayList;
    import java.util.List;
    import javax.annotation.PostConstruct;
    import javax.faces.application.FacesMessage;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.ViewScoped;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.validator.ValidatorException;
    @ManagedBean
    @ViewScoped
    public class ViewBean implements Serializable {
         private static final long serialVersionUID = 1L;
         private Boolean approved;
         private Boolean notified;
         private String nextAction;
         private List<NextAction> availableNextActions;
         public Boolean getApproved() {
              return approved;
         public void setApproved(Boolean selection) {
              this.approved = selection;
         public Boolean getNotified() {
              return notified;
         public void setNotified(Boolean selection2) {
              this.notified = selection2;
         public String getNextAction() {
              return nextAction;
         public void setNextAction(String nextAction) {
              this.nextAction = nextAction;
         public void triggerApprovedChange() {
              changeAvailableNextActions();
              setNextAction(null);
         public List<NextAction> getAvailableNextActions() {
              return availableNextActions;
         private void setAvailableNextActions(List<NextAction> availableNextActions) {
              this.availableNextActions = availableNextActions;
         public void changeAvailableNextActions() {
              List<NextAction> nextActions = new ArrayList<NextAction>();
              if( Boolean.TRUE.equals( getApproved() )) {
                   nextActions.add( new NextAction("PEND", "Pend"));
              nextActions.add( new NextAction("REQADVICE", "Request Advice"));
              nextActions.add( new NextAction("FIN", "Finish"));
              setAvailableNextActions(nextActions);
         @PostConstruct
         public void init() {
              changeAvailableNextActions();
         public void validateNotified(
              FacesContext context,
            UIComponent toValidate,
            Object value)
              throws Exception
              List<FacesMessage> messages = new ArrayList<FacesMessage>();
              Boolean isNotified = (Boolean) value;
              if( Boolean.FALSE.equals( isNotified ) && "PEND".equals( nextAction )) {
                   FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
                        "Notified must be true when action is PEND", null);
                   messages.add( message );
              if( messages.size() > 0 ) {
                   throw new ValidatorException(messages);
         public class NextAction implements Serializable {
              private static final long serialVersionUID = 1L;
              private String label;
              private String value;
              public NextAction(String aValue, String aLabel) {
                   value = aValue;
                   label = aLabel;
              public String getLabel() {
                   return label;
              public String getValue() {
                   return value;
    }

    gimbal2 wrote:
    jmsjr wrote:
    Ok .. I am confused by what you just said .. as I did say that the same problem STILL exists in Mojarra 2.1.22.
    ergo .. It is not an issue with the usage of JSF but appears to be a bug in the implementation.I meant a bug in the old version that JBoss ships with. But I also mean in general; as you can see JSF 2.x is already on release 22 - the chance of you finding such an easy to trigger bug has become relatively slim. So no, I must assume it is actually a problem with not understanding how JSF ticks properly. Which is understandable since after using it for 5 years it still surprises me occasionally.
    The bug you link to is about values staying the same, not reverting back to a previous state.OK .. Maybe this will be more convincing (?). I change the xhtml so that it also displays ( via h:outputText ) .. the value of the backing bean that is the same value used for the h:selectOneMenu.
    <!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:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head></h:head>
    <h:body>
    <h:form>
           <h:outputLabel value="Approved:"/>
           <h:selectOneRadio id="approved" value="#{viewBean.approved}"
                required="true"
                requiredMessage="Approved is required.">
                <f:selectItem itemValue="true" itemLabel="Yes"/>
                <f:selectItem itemValue="false" itemLabel="No"/>
                <f:ajax
                    event="valueChange"
                    execute="@this"
                    render="nextActionPanel"
                    listener="#{viewBean.triggerApprovedChange()}"/>
           </h:selectOneRadio>
           <h:outputLabel value="Notified:"/>
           <h:selectOneRadio id="notified" value="#{viewBean.notified}"
                required="true"
                requiredMessage="Notified is required."
                   validator="#{viewBean.validateNotified}">
                <f:selectItem itemValue="true" itemLabel="Yes"/>
                <f:selectItem itemValue="false" itemLabel="No"/>
                <f:ajax
                    event="valueChange"
                    execute="@this"
                    render="@none"/>
           </h:selectOneRadio>
            <h:panelGroup id="nextActionPanel">
            Backing Bean value for nextAction is '<h:outputText value="#{viewBean.nextAction}"/>'<br/>
           <h:selectOneMenu id="nextAction"
                 required="true"
                 requiredMessage="Next Action is required."
                 value="#{viewBean.nextAction}">
                 <f:selectItem itemValue="" itemLabel="- Select -" />
                 <f:selectItems
                     value="#{viewBean.availableNextActions}" var="target"
                     itemValue="#{target.value}"
                     itemLabel="#{target.label}"/>
                   <f:ajax
                    event="valueChange"
                    execute="@this"
                    render="nextActionPanel"/>
           </h:selectOneMenu>
            </h:panelGroup>
           <h:commandButton id="submit" value="Submit" render="@form"/><br/>
           <h:messages/>
            <ui:debug/>
    </h:form>
    </h:body>
    </html>All I changed was
    1) Added the following:
    Backing Bean value for nextAction is '<h:outputText value="#{viewBean.nextAction}"/>'<br/>.. which is in the same panel ( <h:panelGroup id="nextActionPanel"> ) as the <h:selectOneMenu>
    2) Changed the render attribute of the h:selectOneMenu so that instead of @none, it is now:
                   <f:ajax
                    event="valueChange"
                    execute="@this"
                    render="nextActionPanel"/>3) Repeated the same steps as before ... and after step [6]:
    3a) The h:outputText says:
    Backing Bean value for nextAction is ''3b) But the h:selectOneMenu still has the PEND option selected.

  • ADF BC how to access session backing bean value in servlet

    Hi everyone,
    How do I access session backing bean value in a servlet?

    Frank, thanks for your reply.
    I'm not sure how I can incorporate this example into my situation. Let me explain more detail about my problem.
    "servlet" in my post here actually means a custom servlet I wrote for rendering an image that is stored in db as ordimage. In this servlet, I get hold of my appmodule by using Configuation.createRootApplicationModule(). By doing so (If I'm not wrong) a new database session/connection is created. What I'm going to achieve is set application context for this new session/connection in db with the data stored in a session backing bean in the view layer.
    I can pass the required data to the servlet thru url parameter, but I don't want to do it this way for the reason that the data may contains sensitive information.
    I hope I have explained myself well.
    Message was edited by:
    bsmt

  • Value from backing bean in javascript confirm in 10.1.3

    Hallo,
    Please help
    I have 2 problems:
    Page with 1 record, where 8 items are updatable.
    In entity I 've a method where I set a value in bean. (BotId1 is one of these 8 updatebale items)
    What I expect: when I change a value in BotId1 the value of botId in ValiderenBotBean will be also changed
    public void setBotId1(Number value) {
    setAttributeInternal(BOTID1, value);
    EL.set("#{ValiderenBotBean.botId}",BotId.toString());
    My bean (session scope):
    package viewcontroller.pagedefs.produceren.backing;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    public class ValiderenBotBean
    private static Log log = LogFactory.getLog(ValiderenBotBean.class);
    private String botId;
    public ValiderenBotBean() {
    // accessors
    public void setBotId(String botId) {
    log.debug("setBotId : " + botId);
    this.botId = botId;
    public String getBotId() {
    log.debug("getBotId : " + this.botId);
    return this.botId;
    Op my generaten page I have the button:
    <af:commandButton actionListener="#{bindings.Commit.execute}"
    action="Commit" onclick="if (validateForm('dataForm')){return(confirm(#{ValiderenBotBean.botId} + 'la')}"
    rendered="#{(((jhsUserRoles['JDMR_PRD03']) or (jhsUserRoles['JDMR_PRD03'])) or (jhsUserRoles['JDMR_PRD03'])) or (jhsUserRoles['JDMR_PRD03'])}" textAndAccessKey="#{nls['SAVE_BUTTON_LABEL_KOPPELENPRODUCTIEGEGEVENS']}"
    id="KoppelenProductiegegevensSaveButton">
    <af:resetActionListener/>
    </af:commandButton>
    I get the following error:
    Foutdetails webpagina
    Gebruikersagent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1; AskTB5.6)
    Tijdstempel: Thu, 17 Feb 2011 13:54:46 UTC
    Bericht: Syntaxisfout
    Regel: 3744
    Teken: 1
    Code: 0
    URI: http://172.16.6.108:8988/demeter/adf/jsLibs/Common10_1_3_2_0.js
    The code from Common:
    3732 function _callChained(
    3733 a0,
    3734 a1,
    3735 a2
    3736 )
    3737 {
    3738 if(a0&&(a0.length>0))
    3739 {
    3740 if(a2==(void 0))
    3741 {
    3742 a2=a1.window.event;
    3743 }
    3744 var a3=new Function("event",a0);
    3745 a1._tempFunc=a3;
    3746 var a4=a1._tempFunc(a2);
    3747 a1._tempFunc=(void 0);
    3748 return!(a4==false);
    3749 }
    3750 else
    3751 {
    3752 return true;
    3753 }
    3754 }
    Problem nr.1:
    When I call the button I do not see any logging that indicate that the value is set in backing bean
    Workaround: I made item on my page depending on item where I put my code.
    Result: I have to press 2 times on my button to execute the button code. First time to make the validation and the second time the button code itself.
    Not nice. The validation is also slow.
    But ok:
    Problem 2:
    I still get the same error, I see logging of execution of my validation.
    There is also the difference between loggings is 2 cases:
    If I use
    onclick="if (validateForm('dataForm')){return((#{ValiderenBotBean.botId} + 'la')}"
    what I really want instead of
    onclick="if (validateForm('dataForm')){return'la')}"
    I get:
    17-feb 14:28:40 DEBUG (ValiderenBotBean) -getBotId : -1
    17-feb 14:28:40 DEBUG (ValiderenBotBean) -getBotId : -1
    It means that value is obtained correctly.
    But still the same error.
    If I put for test purpose
    the following code into my bean:
    public String getBotId() {
    log.debug("getBotId : " + this.botId);
    botId = "23";
    return this.botId;
    I do not get any error.
    Any ideas?
    Please help

    Thanks, Amit,
    I will try it tomorrow.
    Some remarkes:
    1. I need javascript for confirmation
    2. I really do not PPR. It takes so long. The user use the scanner to put the value into input items in order speed up the process. And now PPR...
    3. My transient attribute will depend on 8 items. Even more waiting process.
    What I really want is to execute my db function only 1 time "onclick" or "oncommit" and according to outcome of db-function ask user for confirmation of commit.
    I tried already to implement dialog from ADF with launchDialog function.
    But ReturnListener did not function while I launch the Dialog manually.
    Anna

  • How to get current db value in backing bean

    Hi,
    I'm using jdeveloper 11.1.2.3.0
    I would like to know how could I access the old value of an attribute in backing bean.
    I know I can get it in the EntityImpl level with getPostedAttribute function,
    but as I see I don't have permission to access this function in the ViewImpl.
    I get this error:
    Error(151,33): getPostedAttribute(int) has protected access in oracle.jbo.server.EntityImpl.
    Could you help?
    What is the correct way to get the current value on db in backing bean?
    Thanks a lot!

    You can add a transient attribute to the Entity object to hold the old value of the desired attribute, then you can add this attribute to the view object.
    check [url http://www.youtube.com/watch?v=iKVIiK0FBXI]Retrieving the previous value of an ADF BC attribute 

  • How to get readonly text field value in backing bean?

    Below is my code in JSF.
    <h:inputText id="prodLine" value="#{fbackingBean.value}" required="true" styleClass="readOnlyField" readonly="true"/>
    This is a readonly field, and the value will been pass in by a pop up window. after the value had been passed in, i try to store the data which i had selected, but the value in readonly field (which show in above) return a null value.
    May i noe how can i get the readonly field value in backing bean? thanks!

    Why not keep track of the value in the backing bean? If it's a read only value set from a backing bean it should be simple to retrieve from a backing bean.
    I'm new to JSF, but one thing that I have figured out is to try to put everything in the backing beans possible and to do as little as possible within the JFS web page components.

  • Backing bean properties not getting updated

    I have an input text in my JSP page and it is component-bound to backing bean. The problem is that when I change value of the InputText in the JSP, the value is not getting updated in the backing bean.
    Here is the InputField definition in JSP page.
    <h:inputText binding="#{backing_employeeEdit.firstName}"
    id="firstName"/>
    and here is the setter in backing bean
    public void setFirstName(HtmlInputText inputText1) {
    this.firstName = inputText1;
    Pls note that there is no validation errors because the page navigates successfully. The only problem is that new value is not updated.

    I don't know, wht exactly u wants to do... Here is java code and is working fine for me...
    Emp.java
    public void action() {
         System.out.println(inputText.getValue());
         Emp tt = new Emp();
         inputText.setValue(inputText.getValue().toString()+"bilal");
         tt.setInputText(inputText);
         System.out.println(inputText.getValue());
    JSP...
    <f:view>
    <h:form>
    <h:inputText binding="#{emp.inputText}" />
    <h:commandButton value="submit" action="#{emp.action}" />
    </h:form>
    </f:view>
    faces-config file contents....
    <managed-bean>
              <managed-bean-name>emp</managed-bean-name>
              <managed-bean-class>
                   com.nous.application.Emp
              </managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    Here scope has to be session, otherwise u will lose old value...

Maybe you are looking for