How Do I Know Which commandButton was Clicked in the Validation Phase?

I have three <h:commandButton ... /> components in a single form. In order to implement some validation rules, I need to know which one was clicked. I cannot rely on the configured actionListener methods because they have not yet been invoked in the JSF life-cycle.
It seems that the components representing each of these buttons get created and their values are all set to null. So that doesn't help.
I could set a hidden field using a JavaScript onclick event handler, but that seems to be a hack for something that any decent web application framework should be able to handle elegantly.
Thanks in advance for any help.
Atif Faridi

Thanks for the quick reply.
I considered that, but ruled it out as an option because I was convinced that JSF would offer something better.

Similar Messages

  • How can I know which link was clicked in the link list

    Hi everyone
    I'm using list of links in my page to display list of the files in some directory.
    How can I know which link user was clicked. There are some code:
    <%
    String dir = "..//files//";
    File fin = new File(dir);
    File files[]=fin.listFiles();
    for(int i=0;i<files.length;i++)
    File x = files;
    %>
    <%=x.getName()%><br>
    <%
    %>
    Please help

    You need to pass some data on the querystring to the page you are linking to.
    <a href="Main_Work.jsp?file=<%=x.getName()%>"><%=x.getName()%></a><br>
    This will send a parameter called "file" with the value of the file name that the user clicked.
    Now in Main_Work.jsp you can access this data as follows:
    <%
    String s = request.getParameter("file");
    File f = new File("..//files//"+s);
    %>

  • How can I determine which image was clicked in 3D carousel?

    I have been modifying some 3D carousel code that I found in hopes that I can get it such that when image "resolv2.jpg" (or any of my other images) is clicked on at the front of my carousel, it goes to a specific webpage. By just replacing "moveBack(event.target) from the toggler section of the code with "navigateToURL:(newURLRequest('http://google.com'), the target DOES sucessfully go to google when clicked on. However, I want to modify this code by altering the else statement to say something to the effect of "else if event.target (clicked on object) is 'resolv2.jpg' THEN go to google". So essentially, my question is how can I determine which image was clicked? Here is the entire code with the area I was altering bolded:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="init();" backgroundGradientColors="[#000033, #000033]" backgroundGradientAlphas="[1.0, 1.0]">
    <mx:Script>
              <![CDATA[
    //Import Papervision Classes
                   import org.papervision3d.scenes.*;
                   import org.papervision3d.cameras.*; 
                   import org.papervision3d.objects.*;
                   import org.papervision3d.objects.primitives.*;
                   import org.papervision3d.materials.*;
                   import org.papervision3d.materials.shadematerials.*;
                   import org.papervision3d.materials.utils.MaterialsList;
                   import org.papervision3d.lights.*;
                   import org.papervision3d.render.*;
                   import org.papervision3d.view.*;
                   import org.papervision3d.events.*;
                   import org.papervision3d.core.*;
                   import org.papervision3d.lights.PointLight3D;
                   import flash.filters.DropShadowFilter;
                         import caurina.transitions.*;
                         private var numOfItems:int = 5;
                         private var radius:Number = 600;
                         private var anglePer:Number = (Math.PI*2) / numOfItems;
                         //private var dsf:DropShadowFilter = new DropShadowFilter(10, 45, 0x000000, 0.3, 6, 6, 1, 3);
                   public var angleX:Number = anglePer;
             public var dest:Number = 1;
                   private var theLight:PointLight3D;
            //Papervision Engine
                   private var viewport:Viewport3D; 
                   private var scene:Scene3D; 
                   private var camera:Camera3D;
                   private var renderer:BasicRenderEngine;
             private var planeArray:Array = new Array();
             [Bindable]
             public var object:Object;
             private var arrayPlane:Object;
             private var p:Plane;
             //Initiation function           
             private function init():void 
             viewport = new Viewport3D(pv3dCanvas.width, pv3dCanvas.height, false, true); 
             pv3dCanvas.rawChildren.addChild(viewport); 
             viewport.buttonMode=true;
             renderer = new BasicRenderEngine();
             scene = new Scene3D(); 
             camera = new Camera3D();
             camera.zoom = 2; 
             createObjects(); 
             addEventListeners();
    //Create Objects function          
              private function createObjects():void{
              for(var i:uint=1; i<=numOfItems; i++)
                        /* var shadow:DropShadowFilter = new DropShadowFilter();
                        shadow.distance = 10;
            shadow.angle = 25; */
                        var bam:BitmapFileMaterial = new BitmapFileMaterial("images/resolv"+i+".jpg");
                        bam.oneSide = false;
                        bam.smooth = true;
            bam.interactive = true;
                        p = new Plane(bam, 220, 200, 2, 2);
                        p.x = Math.cos(i*anglePer) * radius;
                        p.z = Math.sin(i*anglePer) * radius;
                        p.rotationY = (-i*anglePer) * (180/Math.PI) + 270;
                        scene.addChild(p);
                        //p.filters=[shadow];
                        p.extra={pIdent:"in"};
                        p.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, toggler);
            planeArray[i] = p;
              // create lighting
            theLight = new PointLight3D();
            scene.addChild(theLight);
            theLight.y = pv3dCanvas.height;
              private function toggler(event:InteractiveScene3DEvent):void
                            // if the cube's position is "in", move it out else move it back
                            if (event.target.extra.pIdent == "in")
                                    moveOut(event.target);
                            else
                                   moveBack(event.target);
                    private function moveOut(object:Object):void
                              trace(object +" my object");
                            // for each cube that was not selected, remove the click event listener
                            for each (var arrayPlane:Object in planeArray)
                                    if (arrayPlane != object)
                                            arrayPlane.removeEventListener(InteractiveScene3DEvent.OBJECT_PRESS, toggler);
                            //right.enabled=false;
                            //left.enabled=false;
                            // move the selected cube out 1000 and rotate 90 degrees once it has finished moving out
                            Tweener.addTween(object, {scaleX:1.2, time:0.5, transition:"easeInOutSine", onComplete:rotateCube, onCompleteParams:[object]});
                            Tweener.addTween(object, {scaleY:1.2, time:0.5, transition:"easeInOutSine", onComplete:rotateCube, onCompleteParams:[object]});
                            // set the cube's position to "out"
                            object.extra = {pIdent:"out"};
                            // move the camera out 1000 and move it the to same y coordinate as the selected cube
                            //Tweener.addTween(camera, {x:1000, y:object.y, rotationX:0, time:0.5, transition:"easeInOutSine"});
                    private function moveBack(object:Object):void
                            // for each cube that was not selected, add the click event listener back
                            for each (var arrayPlane:Object in planeArray)
                                    if (arrayPlane != object)
                                            arrayPlane.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, toggler);
                            // move the selected cube back to 0 and rotate 90 degrees once it has finished moving back
                            Tweener.addTween(object, {scaleX:1, time:0.5, transition:"easeInOutSine", onComplete:rotateCube, onCompleteParams:[object]});
                            Tweener.addTween(object, {scaleY:1, time:0.5, transition:"easeInOutSine", onComplete:rotateCube, onCompleteParams:[object]});
                            // set the cube's position to "in"
                            object.extra = {pIdent:"in"};
                            // move the camera back to its original position
                            //Tweener.addTween(camera, {x:0, y:1000, rotationX:-30, time:0.5, transition:"easeInOutSine"});
                            //right.enabled=true;
                            //left.enabled=true;
                    private function goBack():void
                            // for each cube that was not selected, add the click event listener back
                            for each (var arrayPlane:Object in planeArray)
                                    if (arrayPlane != object)
                                            arrayPlane.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, toggler);
                    private function rotateCube(object:Object):void
                            //object.rotationX = 0;
                            //Tweener.addTween(object, {rotationZ:0, time:0.5, transition:"easeOutSine"});
              private function addEventListeners():void{
        this.addEventListener(Event.ENTER_FRAME, render);
    //Enter Frame Listener function             
    private function render(e:Event):void{ 
                     renderer.renderScene(scene, camera, viewport);
                     camera.x = Math.cos(angleX) * 800;                                                  
                     camera.z = Math.sin(angleX) * 800;
    private function moveRight():void
              dest++;
              Tweener.addTween(this, {angleX:dest*anglePer, time:0.5});
              //goBack();
    private function moveLeft():void
              dest--;
              Tweener.addTween(this, {angleX:dest*anglePer, time:0.5});
              //goBack();
              ]]>
    </mx:Script>
              <mx:Canvas width="1014" height="661">
              <mx:Canvas id="pv3dCanvas" x="503" y="20" width="400" height="204" borderColor="#110101" backgroundColor="#841414" alpha="1.0" backgroundAlpha="0.57"> 
              </mx:Canvas>
              <mx:Button x="804" y="232" label="right" id="right" click="moveRight(),goBack()"/>
              <mx:Button x="582" y="232" label="left"  id="left"  click="moveLeft(),goBack()" />
              </mx:Canvas>
    </mx:Application>

    Your answer may be correct, but I am very much a beginner to actionscript, and I was wondering moreso if it is possible to determine the root/url (i.e. images/resolv2.jpg)? Or even if InteractiveScene3DEvent calls a variable that holds this url? However, specifically, I'm just wondering if the actionscript itself could determine the url in a line of code such as "if object == BitmapFileMaterial("/images/resolv2.jpg"); "? Also, here's a copy of InteractiveScene3DEvent in more detail if you think that will help:
    public class InteractiveScene3DEvent extends Event
                         * Dispatched when a container in the ISM recieves a MouseEvent.CLICK event
                        * @eventType mouseClick
                        public static const OBJECT_CLICK:String = "mouseClick";
                         * Dispatched when a container in the ISM receives an MouseEvent.MOUSE_OVER event
                        * @eventType mouseOver
                        public static const OBJECT_OVER:String = "mouseOver";
                         * Dispatched when a container in the ISM receives an MouseEvent.MOUSE_OUT event
                        * @eventType mouseOut
                        public static const OBJECT_OUT:String = "mouseOut";
                         * Dispatched when a container in the ISM receives a MouseEvent.MOUSE_MOVE event
                        * @eventType mouseMove
                        public static const OBJECT_MOVE:String = "mouseMove";
                         * Dispatched when a container in the ISM receives a MouseEvent.MOUSE_PRESS event
                        * @eventType mousePress
                        public static const OBJECT_PRESS:String = "mousePress";
                         * Dispatched when a container in the ISM receives a MouseEvent.MOUSE_RELEASE event
                        * @eventType mouseRelease
                        public static const OBJECT_RELEASE:String = "mouseRelease";
                         * Dispatched when the main container of the ISM is clicked
                        * @eventType mouseReleaseOutside
                        public static const OBJECT_RELEASE_OUTSIDE:String = "mouseReleaseOutside";
                         * Dispatched when a container is created in the ISM for drawing and mouse interaction purposes
                        * @eventType objectAdded
                        public static const OBJECT_ADDED:String = "objectAdded";
                        public var displayObject3D                                        :DisplayObject3D = null;
                        public var sprite                                                            :Sprite = null;
                        public var face3d                                                            :Triangle3D = null;
                        public var x                                                                      :Number = 0;
                        public var y                                                                      :Number = 0;
                        public var renderHitData:RenderHitData;
                        public function InteractiveScene3DEvent(type:String, container3d:DisplayObject3D=null, sprite:Sprite=null, face3d:Triangle3D=null,x:Number=0, y:Number=0, renderhitData:RenderHitData = null, bubbles:Boolean=false, cancelable:Boolean=false)
                                  super(type, bubbles, cancelable);
                                  this.displayObject3D = container3d;
                                  this.sprite = sprite;
                                  this.face3d = face3d;
                                  this.x = x;
                                  this.y = y;
                                  this.renderHitData = renderhitData;
    Thank you so much!

  • How can I know which file is using by the self-service workflow?

    Dear all:
    In my directory, there are two HRSSA.wft and How can I know which source is using by the workflow of the self-service ?
    my environment is oracle 11.5.9 | self-service 4.1 | workflow builder 2.6
    Thanks
    regards
    Terry

    One way would be to download the HRSSA workflow to a wft file (using the WFLOAD utility - see MOS Doc 578248.1), then comparing this downloaded wft file with the two files you have (using a utility such as diff in Unix). The comparison that reports no differences will identify the wft that was uploaded into the database.
    HTH
    Srini

  • Servlet: How do I know which button was pushed?

    Hi All,
    I have a web page that has two buttons on it, one to log out and to other to retrieve items (HTML is below). I have a servlet that receives the HTTP Respone/Request and passes the Config and Request to an BasicHandlerManager class that will look to see which button was pushed and then perform an action based on the button that was pushed. Well, in the BasicHandlerManager class I do not know how to determine which button on the web page was pushed. How do I determine that? I've found that they 'if' and 'else if' that contains the "Logout" and "Retrieve" always executes the 'if' statement and never the 'else if'. When I swap the "Logout" and "Retrieve" that are in the 'if' 'else if' statement it will still execute the 'if' and not the 'else if'. So, how do I determine which of the 2 buttons was pushed on the web page?
    Here's my HTML and some code from the BasicHandlerManager.
    Thanks for your help.
    HTML Code:
    <INPUT TYPE="HIDDEN" NAME="requestID" VALUE="HOMEPAGE">
    <INPUT TYPE="SUBMIT" NAME="Retrieve" VALUE="Retrieve">
    <INPUT TYPE="SUBMIT" NAME="Logout" VALUE="Logout">
    BasicHandlerManager Class:
    BasicHandler handler = null;
    if (request != null)
        String strRequestID = request.getParameter("requestID");
            if (strRequestID != null)
                if (strRequestID.equals("LOGIN"))
                    handler = new AccountDelegate(config);
                else if (strRequestID.equals("HOMEPAGE"))
                    if (request.getParameter("Logout").equals("Logout"))
                        handler = new Logout(config);
                    else if (request.getParameter("Retrieve").equals("Retrieve"))
                        handler = new ProductDelegate(config);
                if (handler == null)
                    handler = new DefaultHandler(config);
            } // end if (strRequestID != null)
    } // end if (request != null)
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    First change your buttons so they have the same name
    thus
    <INPUT TYPE="HIDDEN" NAME="requestID" VALUE="HOMEPAGE">
    <INPUT TYPE="SUBMIT" NAME="Retrieve" VALUE="Retrieve">
    <INPUT TYPE="SUBMIT" NAME="Logout" VALUE="Logout">
    becomes
    <INPUT TYPE="HIDDEN" NAME="requestID" VALUE="HOMEPAGE">
    <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Retrieve">
    <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Logout">
    Now in your servlet you will want something akin to the following.
         public void performTask(
              HttpServletRequest request,
              HttpServletResponse response)
              throws ServletException, IOException {
              String action = request.getParameter("SUBMIT") ;
              if( "Retrieve".equals(action) ){
                   //     Perform whatever operation needs to be done on Retrieve
              else if( "Logout".equals(action) ){
                   //     Perform whatever operation needs to be done on Logout
              else {
                   //     Perform whatever operation needs to be done if all else fails
         }By giving your buttons different names, which seems like a really good idea at the outset, you give them different parameter names in the request which A) takes up more space in the request and B) means you have to check both parameters. These are essentially the same action (Submitting) so you use the Value to retrieve the action indicated by the button.
    Regards,

  • DataTable with commandLinks  - How do I know which one I clicked?

    So, imagine I have a dataTable which returns rows from my database (any SELECT * FROM TABLE) and I want to, for example, delete the one object from row N, how do I know, if I put <h:commandLinks> after each row, which row I clicked?
    It's been really hard to do such a simple thing in JSF for me. Help!

    You'd better use selectBooleanCheckbox to delete the selected row rather than sommandLink. This way you'll be able to select more than one row and to delete all selected rows at the same time.
    Hope this helps!
    Ragards,
    Mariana Getova

  • No upgrade order confirmation received or a receipt shown in my account, except for retail installement plan contract. How do I know my order was processed since the 25th of September?

    The device installment plan says I start paying in November... but how do I know the More plan with Verizon Edge was processed with my iphone upgrade. I never received email confirmation or receipt of my order--anywhere. It's been a couple of weeks. Please help!

        CrownPrincess,
    Congrats on your new phone! It's surely important to understand your Edge Agreement and account plan. You can view your Agreement under Documents and Receipts section of your My Verizon account http://bit.ly/xB4iTc. Your current calling plan will be shown there, as well. Please let us know if you have any further questions.
    TanishaS1_VZW
    Follow us on Twitter @VZWSupport

  • How would I know which Folio ID listed in the consolidated fulfillment report corresponds to which folio in Producer?

    Specifically I want to separate the iPhone 4 size downloads from the iPhone 5 size. I know if I had Adobe Analytics I could get to that easily – but that’s a few months out for me. I can see three different Folio IDs for the same issue number, I just want to confirm which folio ID goes to which device size.
    Thanks
    Thad

    You probably had to upgrade to Designer 2013 because MS has upgraded most of Office 365 to SharePoint 2013, but 2010 sites are still running in backwards compatible mode.  Either way if you go to Master Pages in SPD in your site and highlight each master
    page you'll see the buttons in the actions section of the Master pages tab.  The current master page will have Set as Default greyed out because it is already the master page being used.  take a look at the outlined section below.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • Which row was clicked in an SQL Query (updateable report)?

    I have an application with a report based on an SQL Query (PL/SQL function ...) defined on the Global Page.
    On the pages where the report is used, I want to click in a particular column (TCKT_ID) and pass the values in that row to another page for processing.
    Things I would like to know:
    1) How to determine which row was clicked?  The column is TCKT_ID and it is used as a link to another page.  The SQLis a non-trivial (for me!) join of tables.
    2) How to refer to the values of the other columns in that row?  Because I format with "div," the columns are named -- no "f02", "f03", etc.
    3) How to pass multiple values (ENAME, JOB, MGR, SAL, COMM) to the target page?  You might ask: Why not just re-query for the data using a unique key.  Splendid idea, but the unique key is four columns so I still need some way to pass these four values to have that unique key.
    I've constructed a "pretty close" example of the situation here:
    WS APEX_EXAMPLES_01
    demo / demo
    Application: Row Info  10782  - Page 0 has the report.  Page 1 displays it with a link (in red) to page 2.
    I think I can complete most of what I need if someone can just show me how to get, say, the ENAME of the row clicked on page 1, so I can use it to filter the query on page 2 to just this row clicked on page 1.
    Using <tt> </tt>, I tried to display the actual row from View -- Source of the real report I'm dealing with but it just comes out like this
    M - F
    MM_O_BD_DAILY.ctl (ftp D046)CMM_O_BD_DAILY.sh (ftp D046)17:15
    10JUN13 17:00:52
    10JUN13 17:00:53
    17:15
    10JUN13 17:00:52
    10JUN13 17:00:53
    17:00
    10JUN13 17:00:59
    10JUN13 17:01:00
    Y
    ARS003_TESTNBD

    I wonder if I'm not understanding something. This seems like a very simple thing to do without any "tricks"
    Take a look, I've modified the LINKING_NUMBER column on the p0 report.
    Basically, you just specify the fields you want to populate and their assignments.  I added 4 destination fields on p2 to receive the assignments.  Then you can do anything you want with them like modifying a report, etc...
    The only trick here is that in order to pass more than 3 items in the URL you need to change your link type from Page in this application to URL.  Then you can specify lost of items this way.
    Thanks
    -Jorge

  • Hierarchical Tree. How do I know which node is selected.

    Hi All,
    I have a Hierarchical tree, How do I know which node is selected
    by the user. Similar is the case with list item.
    Thank You,
    Raj.

    Raj,
    For the hierarchical tree, use the when-tree-node-activated
    trigger and the Ftree.Get_Tree_Node_Property built in to identify
    the node that was selected.
    For a list box use a when-list-changed trigger. To refer to the
    value of the selected list item you can use the block.item
    syntax.

  • HT1451 If I have two iTunes libraries on one computer, how do I know which one is opening when I click on the iTunes icon on the desktop?

    If I have two or more iTunes Libraries on one computer, how do I know which one is opening when I click on the iTunes icon on my desktop?

    You cannot.
    When you sync to a new library, it will erase the current content.
    Use your backup copy of the old computer to copy everything to the new one.

  • How do you specifically let the Itemlistener know which Item was selected..

    How do you specifically let the Itemlistener know which Item was selected in a JComboBox? Anyone has any idea? What should the coding look like?

    getSelectedItem()

  • How do you specifically let an Itemlistener know which Item was selected?

    How do you specifically let the Itemlistener know which Item was selected in a JComboBox? Anyone has any idea? What should the coding look like?

    Hi,
    Try this method
    String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig" };
    JComboBox petList = new JComboBox(petStrings);
    if ( petStrings[0]==(String)petList.getSelectedItem() )
    System.out.println("I'm a bird");
    }else{

  • How can I know which photos are in the library was used in each album I have created before.

    How can I know which photos are in the library was used in each album I have created before?
    I have many photos in the library folder of iPhoto, but actually I don't know which photos were used in my album.
    Is there any method to find this?
    Thanks.

    Album or Book?
    If Album you can find the ones not already used:
    File -> New Smart Album
    Album -> is not -> Any
    Regards
    TD

  • Help me! URGENT cannot find my printer model on hp website - how do i know which cartridge to order.

    Help me! URGENT cannot find my printer model on hp website - how do i know which cartridge to order.

    Depend on which country you are in btw, for the US this should be 61 black and 61 tricolor. For most of europe this will be 301 black and 301 tri color. So to be sure tell me from which country you are.
    Say "Thanks" by clicking the Kudos Star in the post that helped you.
    Although I work for HP my posts and replies are my own
    Please mark the post that solves your problem as "Accepted Solution"

Maybe you are looking for