Multiple h:commandButton

I have two <h:commandButton>'s in my *.jsp. The managed bean attached to the first button works but the second one doesn't.
Thanks in advance !

please give more information. Publish the code here.

Similar Messages

  • Does af:commandButton submit multiple requests at the same time?

    Hi experts,
    I have a question about af:commandButton behavior.
    I have two commandButtons in a page. They are button1 and button2.
    Button1 takes a few seconds to complete its request process.
    So when I click button1, I can click button2 although button1 request is still being processed.
    I checked how ADF faces handled this situation with servlet filter.
    And I saw that button2 request was always submitted after button1 request was completed.
    Due to this behavior, I would assume that commandButton is designed not to submit multiple requests at the same time and guarantees click order.
    However I couldn't found any documents specifying this feature of commandButton.
    If anyone knows it, could you share?
    I know ADF Faces has busyStateListener to prevent user inputs during request round trip.
    But I'd like to make it sure that I don't need to use busyStateListener if I just want to keep processing order.
    Regards,
    Atsushi

    Hi,
    Does anyone know the document specifying the behavior of af:commandButton in case I click two buttons in a page almost simultaneously?
    Any help will be much appreciated.
    Thanks in advance,
    Atsushi

  • CommandButton action method invoked multiple times in standalone OC4J

    Hi,
    We've developed an application in JDeveloper 10.1.3.3.0 (ADF Business Components version 10.1.3.41.57). In one page we have a commandButton with an action method:
    <af:commandButton action="#{MyBean.myActionMethod}"
    blocking="false"
    textAndAccessKey="#{nls['MY_LABEL']}"
    id="myButtonId" >
    <f:actionListener type="oracle.jheadstart.controller.jsf.listener.ResetBreadcrumbStackActionListener"/>
    </af:commandButton>
    This method is defined in a managed bean:
    public String myActionMethod() {
    /* some code */
    return "indexPage";
    There is a navigation-rule for outcome "indexPage". When we run our application in the JDeveloper embedded OC4J instance and click on the commandButton, the action method is invoked once and then the .jspx in the navigation-rule is navigated to.
    We deployed our application to a standalone OC4J instance. Both embedded and standalone OC4J have version: Oracle Containers for J2EE 10g (10.1.3.3.0) (build 070610.1800.23513)
    When we run our application in the standalone OC4J and click on the commandButton, the action method is repeatedly invoked in a seemingly infinite loop.
    We'd appreciate it if someone could shed some light on the matter. Please note that we cannot use <redirect /> in our navigation-rule for "indexPage" because in production we have an Oracle webcache server upstream of our OC4J. Users can only submit HTTPS requests to the webcache, which in turn forwards these requests as HTTP requests.
    Kind regards,
    Ibrahim

    Dear All,
    We'd really appreciate it if somebody would suggest some possible causes even if these might seem fare-fetched. Perhaps compare certain .jar files or something to that effect.
    Anything ????
    Thanks and regards,
    Ibrahim

  • h:commandButton executing multiple times

    I have a simple command button that gets its "action" from a method in a bean. However, the method in the bean sometimes takes a few seconds to finish before it returns the "action". In those few seconds, a user can press the enter key or the command button and it will call the same method with the same values being set...therefore, I get duplicate records in a file.
    Is there a clean and easy way to only allow a user to click/press the command button ONCE on a single page?
    Thanks...

    There is another thread about the same subject with some suggestions:
    http://forum.java.sun.com/thread.jspa?forumID=427&threadID=665472
    Personally, I like to disable the button once it is clicked in Javascript on the browser. Then you have to deal with browser with Javascript disabled or not present. There are suggestion to implement that on the server side as well in the thread.

  • How can I publish my Visio project to PDF including active CommandButtons (VBA)

    Hi everyone,
    First of all, I am new on this forum and a rookie when it comes to Visio and creating PDFs, that's why I need some help. The Visio project where I am working on, is part of my assignment. I am hoping that you could help me.
    I am creating an interactive system for employees with Microsoft Office Visio 2007 that shows flowcharts of procedures and work instructions. Now I created multiple pages and I added hyperlinks (to switch to different levels) and simple CommandButtons (Microsoft Forms 2.0 CommandButton) that show UserForms, which I created in Visual Basic Editor. When I click the CommandButton in the project (on Fullscreen) the UserForm appears.
    For the CommandButtons I added this code:
    Private Sub CommandButton3_Click()
    UserForm4.Show
    End Sub
    This document I created needs to be a controlled document and it should be published in PDF. I know that Visio already has a plugin to publish PDFs, but when I use this option, my project (in PDF) does not show active CommandButtons (where I can click on in order to open my UserForm). Though, the hyperlinks I created, DO work. Do I need to change the VBA code for my CommandButtons or my UserForms, so that I can open my UserForms in the PDF- file? If the answer is 'yes,' does anyone know the code I need to add?
    I also would like to know how I can make my Shape ScreenTips visible in PDF? Do I need to add 'User defined cells' in order to do that or do I need to change something in the Miscellaneous section?
    Many thanks!
    PS: I have enclosed a picture how it should work. You can see one page with a opened UserForm on the lower right. This result (or something similar) I would like to see in the PDF- file.

    You cant transfer interactivity to a PDF when you print to PDF as you have written.
    PDFs have to be exported so that interactivity will live inside the PDF. Of course you have to set up links in the Hyperlink Panels.
    But not every reader is supporting interactivity. URL are supported from Reader and Apple iBooks. But you can't force the user to use a certain application anyway.

  • Multiple instances of the same bean class in session?

    I�m trying to think of a way to have multiple instances of the same bean class in session scope using JSF. For example, let�s say that I have two <h:dataTable>s on the same page. They both use the backing bean called genericBean. Now, the content for genericBean will be different for each <h:dataTable>. In fact, the data source that backs genericBean is not known until runtime. It could be a database, web service, etc.
    What I would like is for when JSF needs access genericBean instead of looking for the value with key �genericBean� in the session map it looks for �genericBean_[some runtime ID]�. I could specify this id in EL on a custom component, as a request parameter or whatever.
    I think that I need the bean to be in session scope because the tables are complex and I want them to be editable.
    I have some ideas about how I can do this but I was wondering if someone has already solved this problem or if there is a standard way to do this using tools like Shale, etc.
    Thanks,
    Randy

    Well, I came up with an interesting solution to this so I thought that I would post it here.
    I have a page that looks like this.
    <html>
    <head>
    <title>My Page</title>
    </head>
    <body>
    <f:view>
    <f:subview id="component1">
    <jsp:include page="component.jsp">
    <jsp:param name="id" value="a" />
    </jsp:include>
    </f:subview>
    <hr>
    <f:subview id="component2">
    <jsp:include page="component.jsp">
    <jsp:param name="id" value="b" />
    </jsp:include>
    </f:subview>
    </f:view>
    </body>
    </html>
    And component.jsp looke like this.
    <f:verbatim>
    <p>
    <h1>Component
    </f:verbatim>
    <h:outputText value=" #{param.id}" />
    <f:verbatim>
    </h1>
    </p>
    </f:verbatim>
    <h:form>
    <h:outputText value="#{component.id}" />
    <h:outputText value="#{component.value}" />
    <h:commandButton value="increment" action="#{component.increment}" />
    <h:commandButton value="decrement" action="#{component.decrement}" />
    <f:verbatim>
    <input type="hidden" name="id"
    value="</f:verbatim><h:outputText value="#{param.id}"/><f:verbatim>" />
    </f:verbatim>
    </h:form>
    The idea is that I want component.jsp to be initialized differently based on the id param. The component managed bean is configured to be in session scope but I want the component instance for id a and id b to be different instances in session scope. Therefore, I added a custom variable resolver to handle this.
    public Object resolveVariable(FacesContext context, String name) {
    // This id will be different for the different subviews.
    HttpServletRequest request = (HttpServletRequest) context.getExternalContext() .getRequest();
    String id = request.getParameter("id");
    // If there is an id in the request then check if this is a bean that can have multiple
    // instances in session scope.
    if ((id != null) && (id.length() > 0)) {
    ExternalContext ec = context.getExternalContext();
    // Build the new name for the key of this bean
    String newName = name + "_" + id;
    Object value = null;
    // See if the bean instance already esists.
    if ((null == (value = ec.getRequestMap().get(newName))) &&
    (null == (value = ec.getSessionMap().get(newName))) &&
    (null == (value = ec.getApplicationMap().get(newName)))) {
         // We could not find the bean instance in scope so create the bean
         // using the standard variable resolver.
    value = original.resolveVariable(context, name);
    // Now check if the bean implements that page component interface. If it is
    // a page component then we want to rename the key to access this bean so
    // that the instance is only used when the id is provided in the request.
    // For example, if there are two components (a and b) we will have in session scope
    // component_a and component_b. The will each point to a unique instance of the
    // Component bean class.
    if (value instanceof PageComponent) {
    // Try to get the value again
    if (null != (value = ec.getRequestMap().get(name))) {
         // Initialize the bean using the id
    ((PageComponent) value).initInstance(id);
    ec.getRequestMap().remove(name);
    ec.getRequestMap().put(newName, value);
    } else if (null != (value = ec.getSessionMap().get(name))) {
    ((PageComponent) value).initInstance(id);
    ec.getSessionMap().remove(name);
    ec.getSessionMap().put(newName, value);
    } else if (null != (value = ec.getApplicationMap().get(name))) {
    ((PageComponent) value).initInstance(id);
    ec.getApplicationMap().remove(name);
    ec.getApplicationMap().put(newName, value);
    return value;
    return original.resolveVariable(context, name);
    }

  • How to handle multiple exception types in JSF 2?

    I'm trying to handle multiple exception types in JSF2, including a default error page for any unexpected exception types. The problems I'm having are:
    1) ViewExpiredException is handled only when no generic exception handler is specified
    2) "Regular" exceptions like NullPointerException are never handled
    My managed bean:
    @Named
    @SessionScoped
    public class MyController implements Serializable {
    /* A method that does nothing */
    public void doNothing() {
        //do nothing
    /* Generate a null pointer exception on purpose */
    public void generateNpe() throws NullPointerException {
        Object x = null;
        x.toString();
    My test page to generate the exception:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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">
    <h:head>
        <title>Test page</title>
    </h:head>
    <h:body>
        <h:form>
            <h:commandButton id="button1" value="do nothing" action="#{myController.doNothing}" />
            <h:commandButton id="button2" value="generate NPE" action="#{myController.generateNpe}" />
        </h:form>
    </h:body>
    </html>
    My web.xml:
    <!-- Redirect all NPEs to this page; this never works! -->
    <error-page>
        <exception-type>java.lang.NullPointerException</exception-type>
        <location>/error/error003.jsf</location>
    </error-page>
    <!-- Redirect all VEEs to this page; this works fine if the next section is excluded -->
    <error-page>
        <exception-type>javax.faces.application.ViewExpiredException</exception-type>
        <location>/error/error002.jsf</location>
    </error-page>
    <!-- This grabs everything, even with the previous sections defined.  If I exclude this error-page section, VEE works fine but NPE still does not get redirected -->
    <error-page>
        <exception-type>java.lang.Exception</exception-type>
        <location>/error/error001.jsf</location>
    </error-page>My questions are as follows:
    1) How can we handle "regular" java exceptions like NPE?
    2) How can we define a catch-all for unexpected exception types, while still respecting specific exception handlers for VEE, etc?
    Thanks,
    Benjamin

    Is your data model right? If you are adding in one and deleting in another it sounds to me more like a process that an entity, in which case you may revisit your data model and simplify it, add in a session bean with the process method to co-ordinate between the two.
    However, if you want to map multiple different tables within a single entity bean it is possible and just part of the mapping. How you actualyl specify it depends on which implementation you are working with.
    Cheers,
    Peter.

  • MDS Customization Problem with multiple root components

    Hello,
    Oracle JDeveloper 11.1.1.5.0 and WebLogic Server Version: 10.3.5.0
    I am using Oracle MDS Customization class with the following classes:
    oracle.adf.view.rich.change.MDSDocumentChangeManager
    org.apache.myfaces.trinidad.change.ChangeManager
    org.apache.myfaces.trinidad.change.MoveChildComponentChange
    Based on these classes I am moving UI components
    <af:panelStretchLayout>
    <f:facet name="center">
    <af:region />
    </f:facet>
    </af:panelStretchLayout>
    into another component thanks to the MDS.
    Once I do the movement and persist, I receive the following waning message:
    *<RegionRenderer> <encodeAll> The region component with id: pt1:r1:0:pt2:r1:0:r1 has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance. It is recommended that you restructure the page fragment to have a single root component.*
    When I run the application in Oracle JDeveloper 11.1.1.5.0, it work fine, but when I deploy it on WebLogic Server Version: 10.3.5.0 it is not working.
    I receive the same warning message on the server and in JDeveloper.
    I think that MDS makes a copy of the components that I move because of that it says me that "a page fragment with multiple root components"
    The problem is not because of duplication any of the tags <af:document> <f:view><f:form> <html> <head> <body>
    After the movement and persistence, I also call the FacesContext to reset its view root with the following code:
    FacesContext context =FacesContext.getCurrentInstance();
    String currentView = context.getViewRoot().getViewId();
    ViewHandler vh = context.getApplication().getViewHandler();
    UIViewRoot x = vh.createView(context, currentView);
    x.setViewId(currentView);
    context.setViewRoot(x);
    The idea is that the entire JSF tree to be rebuild on entering page with aim to clear previously drag and drop settings.
    Do you know how I can overcome the problem on the server WebLogic Server Version: 10.3.5.0?
    This worked on Oracle JDeveloper 11.1.1.3.0 and now the problem is with Oracle JDeveloper 11.1.1.5.0.
    Regards,
    Niki

    Hi,
    what the error means is that you have more than one node under the jsp:root node of the fragment. Say the content of your fragment is
    <af:panelGroupLayout id="pgl1">
    </af:PanelGrouPLayout>
    Then this is okay
    if you have
    <af:panelGroupLayout id="pgl1">
    </af:PanelGrouPLayout>
    <af:panelGroupLayout id="pgl2">
    </af:PanelGrouPLayout>
    or
    <af:panelGroupLayout id="pgl1">
    </af:PanelGrouPLayout>
    <af:commandButton id="cb1"/>
    Then these mean duplicated root components. The JDeveloper IDE flags this as Warnings (Structure Window) when selecting the page fragment
    Frank

  • "detected a page fragment with multiple root components" warning

    I am getting a warning on the standalone WLS when I run my page that contains a taskflow as region. I am using a page fragment in my taskflow.
    <Warning> <oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer> <ADF_FACES-60099> <The region component with id: ptMain:r1 has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance. It is recommended that you restructure the page fragment to have a single root component.>
    The warning states the obvious, I have everything within a panelheader in my page fragment. Also, I do not get the warning on the integrated WLS. Any ideas as to why this warning is still popping up in the log? I am using JDev 11.1.1.3.
    Thanks,
    Jessica

    Thank you for responding. I do not have any popups. I do, however, have another region nested within this fragment ( have this warning on another fragment that doesn't have a nested region though). Here is the code for my fragment.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    xmlns:f="http://java.sun.com/jsf/core">
    <af:panelHeader text="Pawn"
    binding="#{backingBeanScope.backing_Fragments_PawnSearch.ph1}"
    id="ph1" type="default">
    <af:panelFormLayout id="pfl2">
    <af:panelSplitter binding="#{backingBeanScope.backing_Fragments_PawnSearch.ps1}"
    id="ps1" orientation="vertical" splitterPosition="62"
    inlineStyle="width:775px; height:660px;">
    <f:facet name="first">
    <af:panelBox text="Search #{bindings.agency.inputValue} Data to Update"
    binding="#{backingBeanScope.backing_Fragments_PawnSearch.pb1}"
    id="pb1">
    <f:facet name="toolbar"/>
    <af:panelGroupLayout id="pgl3" layout="horizontal">
    <af:inputText value="#{bindings.control_number.inputValue}"
    label="Control Number" required="true"
    columns="#{bindings.control_number.hints.displayWidth}"
    maximumLength="#{bindings.control_number.hints.precision}"
    shortDesc="#{bindings.control_number.hints.tooltip}"
    id="it1">
    <f:validator binding="#{bindings.control_number.validator}"/>
    </af:inputText>
    <af:inputDate value="#{bindings.trans_date.inputValue}"
    label="Date" required="true"
    shortDesc="#{bindings.trans_date.hints.tooltip}"
    id="id1">
    <f:validator binding="#{bindings.trans_date.validator}"/>
    <af:convertDateTime pattern="#{bindings.trans_date.format}"/>
    </af:inputDate>
    <af:inputText value="#{bindings.agency.inputValue}" simple="true"
    required="#{bindings.agency.hints.mandatory}"
    columns="#{bindings.agency.hints.displayWidth}"
    maximumLength="#{bindings.agency.hints.precision}"
    shortDesc="#{bindings.agency.hints.tooltip}"
    binding="#{backingBeanScope.backing_Fragments_PawnSearch.it2}"
    id="it2" visible="false">
    <f:validator binding="#{bindings.agency.validator}"/>
    </af:inputText>
    <af:commandButton actionListener="#{bindings.ExecuteWithParams.execute}"
    text="Search"
    disabled="#{!bindings.ExecuteWithParams.enabled}"
    id="cb5"
    returnListener="#{backingBeanScope.backing_Fragments_PawnSearch.refreshPage}"
    action="#{backingBeanScope.backing_Fragments_PawnSearch.RenderMe}">
    <af:setActionListener from="#{bindings.PawnItemView1Iterator.currentRowKeyString}"
    to="#{requestScope.pawnkey}"/>
    </af:commandButton>
    <af:spacer width="10" height="10"
    binding="#{backingBeanScope.backing_Fragments_PawnSearch.s1}"
    id="s1"/>
    <af:goButton text="Clear Values and Create New" id="gb1"
    destination="index.jspx"
    rendered="#{backingBeanScope.backing_Fragments_PawnSearch.saveButtonRendered}"/>
    </af:panelGroupLayout>
    </af:panelBox>
    </f:facet>
    <f:facet name="second">
    <af:panelGroupLayout binding="#{backingBeanScope.backing_Fragments_PawnSearch.pgl4}"
    id="pgl4" layout="scroll" partialTriggers=""
    visible="true">
    <af:panelGroupLayout binding="#{backingBeanScope.backing_Fragments_PawnSearch.pgl6}"
    id="pgl6" inlineStyle="width:775px;"
    visible="#{backingBeanScope.backing_Fragments_PawnSearch.renderTF}">
    <af:region value="#{bindings.PawnEntryFormTF1.regionModel}"
    id="r1" inlineStyle="width:750px;"/>
    </af:panelGroupLayout>
    <af:panelGroupLayout binding="#{backingBeanScope.backing_Fragments_PawnSearch.pgl5}"
    id="pgl5" layout="horizontal"
    visible="#{backingBeanScope.backing_Fragments_PawnSearch.renderMessage}">
    <af:outputFormatted value="No #{bindings.agency.inputValue} Pawn data matching the Control Number and Transaction Date from above."
    binding="#{backingBeanScope.backing_Fragments_PawnSearch.of1}"
    id="of1"
    inlineStyle="font-weight:bolder; font-size:small;"/>
    <af:spacer width="10" height="10"
    binding="#{backingBeanScope.backing_Fragments_PawnSearch.s2}"
    id="s2"/>
    <af:goButton text="Clear Search and Start Again"
    binding="#{backingBeanScope.backing_Fragments_PawnSearch.gb2}"
    id="gb2" destination="index.jspx"/>
    </af:panelGroupLayout>
    </af:panelGroupLayout>
    </f:facet>
    </af:panelSplitter>
    </af:panelFormLayout>
    </af:panelHeader>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_Fragments_PawnSearch-->
    </jsp:root>

  • JSF 1.2 and h:commandButton custom renderer problem

    Hi everyone!
    I'm working on my custom h:commandButton renderer for a couple of hours and I cannot solve some issues...
    First of all: what I want to do is to substiute default h:commandButton renderer with my own which will call standard renderer and puts some other tags. After all I will have something like that:
        <div class="leftbackground">     
           <div class="rightbackground">
               <input type="button" value="Ok" />  --- this is defaulty rendered by h:commandButton renderer
           </div>
        </div>So that I've put some lines info faces-config.xml:
    <render-kit>
             <renderer>
                  <component-family>javax.faces.Command</component-family>
                  <renderer-type>javax.faces.Button</renderer-type>
                  <renderer-class>test.MyCommandButtonRenderer</renderer-class>
             </renderer>
        </render-kit>I've written my own renderer which looks like this:
    package test;
    import java.io.IOException;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    import javax.faces.render.Renderer;
    import com.sun.faces.renderkit.html_basic.HtmlBasicRenderer;
    public class MyCommandButtonRenderer extends HtmlBasicRenderer{
         public MyCommandButtonRenderer(){
              System.out.println("MyCommandButtonRenderer constructor has been calles");
         public void encodeEnd(FacesContext context, UIComponent component)
                   throws IOException {
              try{
              ResponseWriter writer = context.getResponseWriter();
              writer.startElement("h3", component);
              writer.writeText("Hello from a custom JSF UI Component!", null);          
              writer.endElement("h3");  
              }catch(Exception e){
                   e.printStackTrace();
    }After that, when I try to call h:commandButton on my JSF page:
         <f:view>
              <h:form>
                   <h:commandButton  value="Save"  />
              </h:form>
         </f:view>I can see <h3>Hello from a custom JSF UI Component!</h3>. Unfortunately my <input type="button"> isn't rendered.
    I have tried something like this:
    (in MyCommandRenderer}
    public void encodeEnd(FacesContext context, UIComponent component)
                   throws IOException {
              try{
              ResponseWriter writer = context.getResponseWriter();
              writer.startElement("h3", component);
              writer.writeText("Hello from a custom JSF UI Component!", null);          
              writer.endElement("h3");  
              String family = "javax.faces.Command";
              String renderType = "javax.faces.Button";
              Renderer baseRenderer =
                   context.getRenderKit().getRenderer(family , renderType);
              baseRenderer.encodeEnd(context, component);
              }catch(Exception e){
                   e.printStackTrace();
    }but it obviously only rendered multiple h3 elements until StackOverflowException is being thrown (it calling himself again and again).
    What am I doing wrong? Why my <input type="button"> isn't called? How to call default h:commandButton renderer and told him to render <input type=button> ? Is there any commandButton renderer class I can extend ?Which renderer is used by default by CommandButton component?
    Thanks in advance for any help. I'm really close to leave off my work and stay with something more familiar ;)
    Sorry for my bad English.
    Looking forward to hearing from you,
    Matthew
    Edited by: MatthewPL on Nov 28, 2007 12:42 AM

    To the best of my knowledge, the standard does not specify the default renderer class for any components.
    I would take a wrapper/decorator approach. Add a field to your renderer for the default renderer. Before configuring your renderer, obtain the default renderer and set it on your renderer, then configure it.
    OTOH, there might be easier ways for you to accomplish what you want to do. You could use a PhaseListener to add components to the view whenever a commandButton is encountered in the tree.

  • Multiple times constructors calling in Myfaces

    Hi
    i m fasing multiple times constructor calling for myfaces programs
    i have created a small web appl. with one text box and one submit button, to test this behaviour.
    i have used this sample to
    get web page
    enter some text value
    submit the page
    and atlast page get returned to me
    i don't understand the multiple times consturctor calling and exact sequence of Getter/Setter calling?
    Following are details -
    faces-config.xml
    <managed-bean>
    <managed-bean-name>fileUploadBean</managed-bean-name>
    <managed-bean-class>com.dbschenker.dts.model.backingbean.FileUpload</managed-bean-class>
    <manged-bean-scope>request</manged-bean-scope>
    </managed-bean>
    jsp file
    <h:inputText id="txtSample" value="#{fileUploadBean.txtName}"/>
    <h:commandButton action="#{fileUploadBean.uploadFile}"
    image="../../images/upload_0.png"
    onmouseover="this.src='../../images/upload_0.png'"
    onmouseout="this.src='../../images/upload_1.png'"
    onclick="return true;"/>
    Backing bean
    public class FileUpload {
    private String txtName;
    public void setTxtName(String txtName) {
    System.out.println("Calling Setter... ");
    this.txtName= txtName;
    public String getTxtName() {
    System.out.println("Calling Getter... ");
    return txtName==null?"":this.txtName;
    public FileUpload() {
    System.out.println("Calling Constructor... ");
    public String uploadFile() {
    System.out.println("Upload Form Submitted... ");
    return "";
    Output to Console
    Calling Constructor...
    Calling Getter...
    Calling Constructor...
    Calling Constructor...
    Calling Getter...
    Calling Constructor...
    Calling Setter...
    Calling Constructor...
    Upload Form Submitted...
    Calling Constructor...
    Calling Getter...

    Hi
    that blog was really good and in depth...
    but i have one real time problem with multiple time constructor calling
    if you replace text box with file upload tag in my earlier sample program and then following is out put ...
    Calling Constructor...
    getUploadedFile()...
    Calling Constructor...
    getUploadedFile()...
    Calling Constructor...
    setUploadedFile()...
    Uploaded File Name - D:\AsnUploadTemplate02.XLS
    Calling Constructor... ------------------(.1
    Upload Form Submitted...
    java.lang.NullPointerException
         at com.dbschenker.dts.model.backingbean.FileUpload.uploadFile(FileUpload.java:40)
    ----------- trailing exception stack trace...
    Calling Constructor...
    getUploadedFile()...
    form this output u can find that my UploadedFile backing bean object gets null just before form submit method...
    whereas its has been properly instantiated in setter method,
    if constructor (1 wasn't call then object (uploadedFile) can be found in method (FileUpload.uploadFile)
    i have also tried to make scope of backing bean Session , but constructor, getter & setter calling sequence doesn't different even after.
    i have also considered both of your blog as ---
    http://balusc.blogspot.com/2006/09/debug-jsf-lifecycle.html
    http://balusc.blogspot.com/2008/02/uploading-files-with-jsf.html
    but my problem stands as it is
    kindly help

  • Toggling between single and multiple selection in a table

    I am working on ADF faces. I need to switch between single and multiple selection in <af:table based on a button I select.
    I cannot use switcher or rendered property inside <af:table. Only the first one is rendering the second one is not rendering based on the switch
    <f:facet name="selection">
    <af:tableSelectMany autoSubmit="true"
    rendered="#{treeBean.multipleRows}"/>
    </f:facet>
    <f:facet name="selection">
    <af:tableSelectOne autoSubmit="true"
    rendered="#{treeBean.singleRows}"/>
    </f:facet>
    When I use inside the switcher, it doesn't like the parent.
    Any ideas would be greatly appreciated.
    Thanks,
    Vijay.

    I have probably misunderstood what your issue is. I do not know what your version of ADF faces is. Here is some sample code working with my version. Please check if your jdev has "rowSelection" attribute. If it has, please try my sampe code
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:afh="http://xmlns.oracle.com/adf/faces/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces">
    <jsp:directive.page contentType="text/html;charset=utf-8"/>
    <f:view>
    <af:document title="tableSelectMany Demo">
    <af:form>
    <af:panelGroup layout="vertical">
    <af:messages/>
    <af:selectOneChoice value="#{sessionScope.tableSelection}"
    autoSubmit="true"
    id="selType"
    label="Selection Type">
    <af:selectItem label="Single" value="#{null}"/>
    <af:selectItem label="Multiple" value="#{true}"/>
    </af:selectOneChoice>
    <af:table summary="Periodic table"
    binding="#{tableActions.table}"
    partialTriggers="selType"
    rowSelection="#{sessionScope.tableSelection ? 'multiple' : 'single'}"
    value="#{periodicTable.tableData}" var="row" rows="10">
    <af:column>
    <f:facet name="header">
    <af:outputText value="Name"/>
    </f:facet>
    <af:outputText value="#{row.name}"/>
    </af:column>
    <af:column>
    <f:facet name="header">
    <af:outputText value="Symbol"/>
    </f:facet>
    <af:outputText value="#{row.symbol}"/>
    </af:column>
    <af:column>
    <f:facet name="header">
    <af:outputText value="Action Column"/>
    </f:facet>
    <af:commandButton immediate="true" text="Action"
    action="#{row.action}"/>
    </af:column>
    </af:table>
    </af:panelGroup>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>

  • ADF: commandButton doesn't reach target method

    Hi All,
    This is my first post here, i hope you can help me, i am new in ADF, and now i am facing with an issue, let me explain:
    ADF Business Components     11.1.1.55.36
    jDeveloper 11g Release 1 11.1.1.2.0
    In the aplication i have a button that change the "render" attribute of an showDetailItem, this object conatains some commandButons but when i click over these buttons the listener method is never triggered. i don't know what's happend with this situation. Any idea is always welcome.
    Thanks in advance,
    Sergio Valdez
    Code:
    activation commandButton at line: 58
    rendered showDetailItem at line: 125
    problem commandButtons at lines: 132 & 139
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
              xmlns:c="http://java.sun.com/jsp/jstl/core">
      <c:set var="viewcontrollerBundle"
             value="#{adfBundle['com.axtel.reporteador.MessageBundle']}"/>
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1">
          <af:form id="f1">
            <af:panelStretchLayout topHeight="50px" id="psl1" bottomHeight="26px">
              <f:facet name="top">
                <af:panelGroupLayout layout="scroll"
                                     xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                                     id="pgl2">
                  <af:inputText label="#{viewcontrollerBundle.NOMBRE_DE_ENCUESTA}" id="surveyName"
                                value="#{SurveyMB.surveyName}"/>
                  <af:panelGroupLayout id="pgl3">
                    <af:commandButton text="#{viewcontrollerBundle.CREATE_SURVEY}" id="surveyCreate"
                                      actionListener="#{SurveyMB.createSurveyListener}"/>
                    <af:commandButton text="#{viewcontrollerBundle.RESET_SURVEY}" id="surveyCancel"
                                      actionListener="#{SurveyMB.cancelSurveyListener}"/>
                    <af:commandButton text="#{viewcontrollerBundle.SURVEY_ADD_QUESTION}"
                                      id="addQuestion"
                                      actionListener="#{SurveyMB.addQuestionListener}"
                                      rendered="#{SurveyMB.surveyAlreadyCreated}"
                                      disabled="#{SurveyMB.questionAddEnable}"/>
                  </af:panelGroupLayout>
                </af:panelGroupLayout>
              </f:facet>
              <f:facet name="center">
                <!-- id="af_one_column_header_stretched"  -->
                <af:panelAccordion id="questionAccordionPanel" discloseNone="true"
                                   partialTriggers="addQuestion">
                  <af:forEach items="#{SurveyMB.survey.questions}" var="question"
                              varStatus="i">
                    <af:showDetailItem text="#{question.question}"
                                       id="questionDetailItem"
                                       disclosed="#{( SurveyMB.questionEditEnable) and (i.index eq SurveyMB.questionToBeEdited)}"
                                       disabled="#{(( SurveyMB.questionEditEnable) &amp;&amp; ( SurveyMB.questionToBeEdited ne i.index)) or SurveyMB.questionAddEnable}">
                      <f:facet name="toolbar">
                        <af:group id="g1">
                          <af:outputText value="outputText1" id="ot1"/>
                          <af:commandButton text="#{viewcontrollerBundle.SURVEY_ANSWER_DELETE}"
                                            id="questionDelete"
                                            actionListener="#{SurveyMB.deleteQuestionListener}">
                            <af:clientAttribute name="questionIndex"
                                                value="#{i.index}"/>
                          </af:commandButton>
                          <af:commandButton text="#{viewcontrollerBundle.SURVEY_QUESTION_EDIT}"
                                            id="questionEdit"
                                            actionListener="#{SurveyMB.editQuestionListener}">
                            <af:clientAttribute name="questionIndex"
                                                value="#{i.index}"/>
                          </af:commandButton>
                          <af:commandButton text="#{viewcontrollerBundle.SURVEY_ADD_ANSWER}"
                                            id="questionAddAnswer"
                                            actionListener="#{SurveyMB.addAnswerListener}">
                            <af:clientAttribute name="questionIndex"
                                                value="#{i.index}"/>
                          </af:commandButton>
                        </af:group>
                      </f:facet>
                      <af:panelGroupLayout id="pgl5">
                        <af:panelGroupLayout id="questionEditPanel"
                                             rendered="#{SurveyMB.questionEditEnable}">
                          <af:selectOneChoice label="#{viewcontrollerBundle.SURVEY_QUESTION_TYPE}"
                                              id="questionTypeToEdit">
                            <af:selectItem label="Seleccion Multiple"
                                           value="checkbox" id="selectItem1"/>
                            <af:selectItem label="Seleccion simple"
                                           value="radiobutton" id="selectItem2"/>
                          </af:selectOneChoice>
                          <af:inputText label="#{viewcontrollerBundle.SURVEY_QUESTION}"
                                        id="questionToEdit" rows="2"/>
                          <af:commandButton text="#{viewcontrollerBundle.ADD}"
                                            id="questionEditOk"
                                            actionListener="#{SurveyMB.addQuestionOkListener}"/>
                          <af:commandButton text="#{viewcontrollerBundle.CANCEL}"
                                            id="questionEditCancel"
                                            actionListener="#{SurveyMB.addQuestionCancelListener}"/>
                        </af:panelGroupLayout>
                        <af:panelHeader text="Respuesta 1" id="answerHeader"
                                        size="3">
                          <f:facet name="menuBar">
                            <af:commandLink text="#{viewcontrollerBundle.EDITAR}"
                                            id="answerEdit"
                                            actionListener="#{SurveyMB.deleteAnswerListener}"
                                            disabled="#{requestScope.SurveyMB.editAnswerLinkEnable}"/>
                          </f:facet>
                          <f:facet name="toolbar">
                            <af:commandLink text="#{viewcontrollerBundle.ELIMINAR}"
                                            id="answerDelete"
                                            actionListener="#{SurveyMB.editAnswerListener}"
                                            disabled="#{requestScope.SurveyMB.deleteAnswerLinkEnable}"/>
                          </f:facet>
                          <af:panelGroupLayout id="answerEditPanel"
                                               rendered="#{SurveyMB.answerEditEnable}">
                            <af:inputText label="Label 3" id="answerToEdit"/>
                            <af:commandButton text="#{viewcontrollerBundle.OK}"
                                              id="answerEditOk"/>
                            <af:commandButton text="#{viewcontrollerBundle.CANCEL}"
                                              id="answerEditCancel"/>
                          </af:panelGroupLayout>
                        </af:panelHeader>
                        <af:panelHeader text="#{viewcontrollerBundle.SURVEY_ADD_ANSWER}"
                                        id="panelHeader2" size="3"
                                        rendered="#{SurveyMB.answerAddEnable}">
                          <f:facet name="menuBar"/>
                          <af:panelGroupLayout id="panelGroupLayout1">
                            <af:inputText label="Label 3" id="answerToAdd"/>
                            <af:commandButton text="#{viewcontrollerBundle.OK}"
                                              id="answerAddOk"
                                              actionListener="#{SurveyMB.addAnswerOkListener}"/>
                            <af:commandButton text="#{viewcontrollerBundle.CANCEL}"
                                              id="answerAddEdit"
                                              actionListener="#{SurveyMB.addAnswerCancelListener}"/>
                          </af:panelGroupLayout>
                        </af:panelHeader>
                      </af:panelGroupLayout>
                    </af:showDetailItem>
                  </af:forEach>
                  <af:showDetailItem text="#{viewcontrollerBundle.SURVEY_ADD_QUESTION}"
                                     id="showDetailItem1"
                                     disclosed="true"
                                     rendered="#{SurveyMB.questionAddEnable}"
                                     partialTriggers="addQuestion">
                    <f:facet name="toolbar">
                      <af:group id="group1">
                        <af:commandButton text="#{viewcontrollerBundle.OK}"
                                          id="questionAddOk"
                                          actionListener="#{SurveyMB.addQuestionOkListener}"
                                          immediate="true"
                                          binding="#{SurveyMB.addQuestionOkBinding}"
                                          action="#{SurveyMB.questionAddOkAction}"
                                          partialTriggers="addQuestion"/>
                        <af:commandButton text="#{viewcontrollerBundle.CANCEL}"
                                          id="questionAddCancel"
                                          actionListener="#{SurveyMB.addQuestionCancelListener}"
                                          partialTriggers="addQuestion"/>
                      </af:group>
                    </f:facet>
                    <af:panelGroupLayout id="panelGroupLayout2">
                      <af:panelGroupLayout id="pgl8"
                                           partialTriggers="addQuestion">
                        <af:selectOneChoice label="#{viewcontrollerBundle.SURVEY_QUESTION_TYPE}"
                                            id="questionTypeToAdd">
                          <af:selectItem label="Seleccion Multiple" value="checkbox"
                                         id="si2"/>
                          <af:selectItem label="Seleccion simple"
                                         value="radiobutton" id="si1"/>
                        </af:selectOneChoice>
                        <af:inputText label="#{viewcontrollerBundle.SURVEY_QUESTION}"
                                      id="questionToAdd" rows="2"/>
                      </af:panelGroupLayout>
                    </af:panelGroupLayout>
                  </af:showDetailItem>
                </af:panelAccordion>
              </f:facet>
              <f:facet name="bottom">
                <af:panelGroupLayout id="pgl1">
                  <af:commandButton text="#{viewcontrollerBundle.SURVEY_SAVE}" id="surveySave"
                                    action="#{SurveyMB.surveySaveAction}"/>
                  <af:commandButton text="#{viewcontrollerBundle.CANCEL}"
                                    id="cancelSurvey"
                                    action="#{SurveyMB.cancelSurveyAction}"/>
                </af:panelGroupLayout>
              </f:facet>
            </af:panelStretchLayout>
          </af:form>
        </af:document>
      </f:view>
      <!--oracle-jdev-comment:preferred-managed-bean-name:SurveyMB-->
    </jsp:root>Edited by: user2931026 on 10-abr-2010 1:13
    Edited by: user2931026 on 10-abr-2010 9:01

    Sergio,
    good work, now I can read the code :-)
    Strange, nothing pops up right away.
    The buttons in the showDetailItem are the only ones not working?
    One thing you can try is to use the visible property instead of the rendered attribute. The UI looks the same, but the properties behave different (rendered=false means the components are not on the page, visible=false means the components are on the page but are not shown to the user).
    Timo

  • Action Listener Method called multiple times

    I have a page (fragment .jsff), containing a simple input text and a button called "search". When I click on "Search" the action listener is triggered multiple times. (The results are displayed in a table inside a panel collection).
    The results are actually coming back ok.
    When I debug the code, I can see the action listener method called twice.
    Do you know why is that?
    What should I be taking care of?
    This is my code :
    *** Fragment ****
    <af:commandButton text="#{identityBundle.search_label}" id="cb1"
    actionListener="#{UserDetailsBean.searchUsersListener}"
    disabled="#{!bindings.searchUsers.enabled}"/>
    *** Managed bean ***
    public void searchUsersListener(ActionEvent actionEvent) {
    // Add event code here...
    DCBindingContainer bindings = (DCBindingContainer)getBindings();
    DCIteratorBinding iter = bindings.findIteratorBinding("userIterator");
    DCDataRow row = (DCDataRow)iter.getCurrentRow();
    User user = (User)row.getDataProvider();
    boolean isSearchCriteriaPresent = false;
    if(user != null){
    String fn = user.getFirstname();
    if(fn != null && !fn.trim().equals("")){
    isSearchCriteriaPresent = true;
    user.setLastname(fn);
    user.setNonMTUserLogin(fn);
    try {
    Map <Object, Object> userMap = PropertyUtils.describe(user);
    for(Map.Entry<Object, Object> entry: userMap.entrySet()){
    if(entry.getKey() != null && entry.getValue() != null && !entry.getKey().toString().equalsIgnoreCase("class")){
    isSearchCriteriaPresent = true;
    break;
    } catch (IllegalAccessException e) {
    e.printStackTrace();
    } catch (InvocationTargetException e) {
    e.printStackTrace();
    } catch (NoSuchMethodException e) {
    e.printStackTrace();
    if(!isSearchCriteriaPresent){
    user.setFirstname("*");
    OperationBinding opBinding = (OperationBinding)bindings.getOperationBinding("searchUsers");
    opBinding.getParamsMap().put("user", user);
    opBinding.execute();
    AdfFacesContext adfFacesCtx = AdfFacesContext.getCurrentInstance();
    Map<String, Object> scopePageFlowScopeVar= adfFacesCtx.getPageFlowScope();
    scopePageFlowScopeVar.put("userSearchCriteria", user);
    ADFContext adfCtx = ADFContext.getCurrent();
    Map sessionScope = adfCtx.getSessionScope();
    sessionScope.put("userSearchCriteria", user);
    setUserSearchCriteria(user);
    if(selectedUserID != null){
    selectedUserID.setValue(null);
    RichTable table = getUserResultsTable();
    DCIteratorBinding searchUsersIterator = (DCIteratorBinding)bindings.get("searchUsersIterator");
    Row[] rows = searchUsersIterator.getAllRowsInRange();
    if(rows.length > 0){
    RowKeySetImpl rks = new RowKeySetImpl();
    ArrayList keyList = new ArrayList();
    keyList.add(rows[0].getKey());
    rks.add(keyList);
    table.setSelectedRowKeys(rks);
    table.setDisplayRowKey(keyList);
    refreshState(table);
    if(!isSearchCriteriaPresent){
    user.setFirstname(null);
    else{
    deleteUserButton.setDisabled(true);
    resetPasswordButton.setDisabled(true);
    enableUserButton.setDisabled(true);
    disableUserButton.setDisabled(true);
    Thanks in advance for your help

    Hi,
    Can you try this?
    1. set partialSubmit=true for the "search" button
    2. set "search" button id as partialTrigger in your result table
    -Prasad

  • Confusion about backing beans and multiple pages

    Hello:
    I'm new to JSF and am confused by several high level and/or design issues surrounding backing beans. The
    application I am working on (not unlike many apps out there, I suspect), is comprised of several forms which
    collect various query parameters and other pages that display the query results via dataTables. Additionally, the
    displayed results have hyper-text enabled content sprinkled throughout in order to allow further "drill-down" to
    greater details about a given result.
    Obviously, the initial forms are backed by a managed bean that has the getters/setters for each of the various
    fields. From a modularization perspective, I'd prefer to have the query execution in a separate class entirely,
    which I can accomplish via delegation or actionListeners. Where I get confused is in the case that one of the
    hyper-text enabled fields needs to invoke yet another query requiring specific values from the original result.
    In this case, how should I design the beans to store the pertinent selection information AND still be able to
    have the resulting 'details' query in a separate class.
    For example, let's assume that I have a form with a simple backing bean to collect initial query params. The user
    fills out the form and clicks on submit. The action field of the <h:commandButton> tag inside the <h:form>
    delegates to a method which performs the query and returns a navigation string to the results display page. The
    results page then uses a <h:dataTable> tag to display the results. However, through the process of displaying the
    results, it will create the hyper-text links as follows:
                        <h:form>
                            <h:commandLink action="viewDetails">
                                <h:inputHidden id="P_ID" value="#{results.id}"/>
                                <h:outputText value="Click here to see details"/>
                            </h:commandLink>
                        </h:form>Notice that the value="#{results.id}" is the key field (in some case I may need more than one) that the subsequent
    details page will need to perform the query. However, this value is stored in the results attribute of the original
    query backing bean. I do NOT want to add yet another level of queries into the same backing bean as I would like
    to keep the original and details query beans separated for maintenance and style reasons. How then, can I get this
    specific value ("#{results.id}") into another backing bean that could be accessed by the subsequent details page
    and query? In general, how does one map a single display element to multiple backing beans (or accomplish the
    effect of having one 'source' bean's value end up in another 'destination' bean's attr? If this is not possible,
    then isn't the details query/page forced to use the same backing bean in order to get the data it needs? If so,
    how can it determine which id was selected in this case?
    I'd appreciate any thoughts, ideas and suggestions here! Is there a better way to design the above in order to
    maintain the separation of logic/control? What is the 'best practice' approach for this sort of stuff?
    Thanks much in advance!

    This is what I have done in the pass
    <h:commandLink action="#{AppAction.getRecord}" >
    <h:outputText value="#{bbr.id}"/>
    <f:param name = "recordid" value ="#{bbr.id}" />
    </h:commandLink>
    within the getRecord method
    String key = "";
    FacesContext facesContext = FacesContext.getCurrentInstance();
         ServletContext servletContext = ServletContext)facesContext.getExternalContext().getContext();
    key = (String)facesContext.getExternalContext().getRequestParameterMap().get("recordid");
    then call you dbmethod passing in the key of the record the user wants to edit
    and then simply return a string to what page you want the user to go to
    I think this is what your looking for

Maybe you are looking for

  • LO Settings (in SBIW) for SD and Inventory before Customizing LO (LBWE)

    Hi, Please let me know the LO Settings(in SBIW) to be maintained in R/3 for SD, Inventory and  Purchasing before Customizing  LO (LBWE). i.e, for : <u>SD</u> 1. Change statistics currency for each sales organization 2. Assign Update Group <u>Inventor

  • [SOLVED]Compiling a program from source (Tomoe)

    I'm trying to compile Tomoe: http://tomoe.sourceforge.jp/cgi-bin/en/blog/index.rb It is a handwriting recognition tool for East Asian languages. For those of you familiar with them, you'd know that there are some characters that are just so obscure y

  • Mac OS 10.4 printing to Windows XP Printer

    I have tried everything. The windows computer has printer sharing enabled, and everything. It is connected wirelessly. I used to be able to, with 10.3, but after upgrading to 10.4, I can't. The Windows printer won't show up in the printer list...It i

  • Problem exporting Web providers [Urgent]

    Hi, I am trying to export a page group transport set. However, when i check and view the Transport Set Export Log shows this warning on all my web providers. Below shows one set of a web provider warning that i received. [17-FEB-06 11:52:26][Warning:

  • Me54 vs me54n

    hi. we have a purchase requisition release strategy and our 1st release is pre-requisit and any of the rest 7level/release code can release once initial release done. (Once the release is effected by initial release code, any one from rest release co