Trouble setting action on RichCommandToolbarButton from bean

I’m creating RichCommandToolbarButton from java bean. The issue I’m running into is setting action on the button.
I expected RichCommandToolbarButton to work like other UIXCommand, RichCommandLink for example. But it does not. Doing the following does not work on RichCommandToolbarButton (and again, does work on RichCommandLink):
RichCommandToolbarButton button = new RichCommandToolbarButton();
String expr = ="#{backingBeanScope.MyBean.doSomething"
MethodExpression me = getExpressionFactory().createMethodExpression(getElContext(), expr, String.class, new Class[]{});
button.setActionExpression(me);
The ONLY way I’m able to set action on RichCommandToolbarButton is the following:
buttonn.addActionListener( new DoSomething() );
where
private static class DoSomething implements ActionListener
public DoSomething ()
public void processAction(ActionEvent actionEvent)
String expr = ="#{backingBeanScope.MyBean.doSomething"
MethodExpression me = getExpressionFactory().createMethodExpression(getElContext(), expr, String.class, new Class[]{});
button.setActionExpression(me);
I really want to set the button's action based on an expression and doing it this way seems very unexpected to me.... Is this the known and expected way that RichCommandToolbarButtons work?
Edited by: user12869467 on Mar 11, 2013 4:35 PM

This is a way you can try , kind of a mixed approach-
http://hazem-adf-tips.blogspot.com/2012/08/some-useful-adf-and-jsf-code-for.html
See section Adding Action and Action Listener to a command component
RichCommandMenuItem menuPage1 = new RichCommandMenuItem();
menuPage1.setId("page1");
menuPage1.setText("Page 1");
menuPage1.setActionExpression(getMethodExpression("page1"));
RichCommandButton button = new RichCommandButton();
button.setValueExpression("disabled",getValueExpression("#{!bindings."+item+".enabled}"));
button.setId(item);
button.setText(item);
MethodExpression me = getMethodExpression("#{bindings."+item+".execute}");
button.addActionListener(new MethodExpressionActionListener(me));
footer.getChildren().add(button);

Similar Messages

  • How to set Action of commandButton from javabean?

    Hi,
    How can I to set Action of commandButton from javabean with JSF 1.1?
    Thanks

    Try this:
    import javax.faces.component.html.HtmlCommandButton;
    Application application = FacesContext.getCurrentInstance().getApplication();
    HtmlCommandButton button = (HtmlCommandButton) application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
    MethodBinding mb = application.createMethodBinding("#{mybean.action}", null);
    button.setAction(mb);

  • How can i set action on UITaBar and get event from that

    Hi All,
    I m doing one apps in which i have to add three UITabBarItem and this is UITabBarSystemItem.
    Now i cannot understand that how can i set action and get event from the?
    And how can i set various views on three tab bar item.
    I have to use UITabBar means i have to use UINavigationController+UITabBar
    My code id
    tabBar =[[UITabBar alloc] initWithFrame:CGRectMake(0,370,320,50)];
    tabBar.backgroundColor =[UIColor blackColor];
    UITabBarItem *search =[[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemSearch tag:0];
    UITabBarItem *recents =[[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemRecents tag:1];
    UITabBarItem *favorites =[[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFavorit es tag:2];
    tabBar.items =[[NSArray arrayWithObjects:search,recents,favorites, nil] retain];
    tabBar.selectedItem = search;
    [myView addSubview:tabBar];
    [tabBar release];
    I add a action:
    UITabBarItem *search =[[UITabBarItem alloc] InitWithTabBarSystemItem:UITabBarSystemItemSearch tag:0 action:@selector(select:)];
    So it error: Warning -no'InitWithTabBarSystemItem:tag:action:' method fount
    So any can help me regarding it?

    Thanks RickMaddy very much.
    I read and do with sample at the View Controller Programming Guide . But when run it only view TabBar with title but haven't got any TabBarItem on it. I searched a few example about TabBar and i did, but i want do a form with a button then press on button it view a form with 2 TabBarItem on TabBar and press each TabBarItem will show correlative form page 1, page 2.
    UITabBarController *tabBarControl = [[[UITabBarController alloc] initWithNibName:nil bundle:nil] autorelease];
    tabBarControl.title = @"Tab bar";
    ViewControl1 *view1 = [[[ViewControl1 alloc] initWithNibName:@"ViewControl1" bundle:nil] autorelease];
    ViewControl1 *view2 = [[[ViewControl1 alloc] initWithNibName:@"ViewControl2" bundle:nil] autorelease];
    tabBarControl.viewControllers = [NSArray arrayWithObjects:view1,view2,nil];
    [self.navigationController pushViewController:tabBarControl animated:YES];

  • Action from bean called out from jsp form

    Hello, I''ve got problem: i have a form inside a jsp site. It is some searching form: i have inputtext and a "search" button.
    I have action connected with this button <h:commandButton id="search" value="Search" action="#{MyBean.searchj}"/>. It works fine when user press that button, the method from bean is been called out, but usually when user is using so kind of form, he press "enter" key instead of pressing "search" button.
    How can I bind (or call) bean method (in this example it is MyBean.search method) when after user writes something in inputtext and press "enter" key?
    Thanks in advance.

    It is a known problem in the current jsf-ri implementation. There is a component of the third party library that sovles this problem.
    See: http://www.jsftutorials.net/defaultActionTag.html
    You can use this library (it is free) or take the javascript code and insert it into your page.

  • Having trouble getting "Set action to take when logon hours expire" to work - Windows Server 2012

    I have a Windows Server 2012 server that allows remote desktop users (sessions are hosted on the server itself). I'm trying to enforce logon hours for these remote desktop users.
    I have specified logon hours for a user and confirmed that they work--they aren't allowed to logon when logon hours are disabled. However, they are allowed to continue a session past their logon hours limit if they are already signed in (which is fine, this
    is the default behavior).
    However, when I try to use the `Set action to take when logon hours expire` option (`User Configuration/Administrative Templates/Windows Components/Windows Logon Options/Set action to take when logon hours expire`), and set the behavior to "Logoff",
    nothing happens--the user can continue their session happily. I've tried applying this policy both for the user's group and for the local computer. I've run `gpresult` for the user and confirmed that the policy is apparently in place.
    I also naively tried the "Force logoff when logon hours expire" option, but that apparently doesn't apply to interactive logins (confusing!).
    Am I misapplying this setting, or do I need to take some other steps to get it to work? I'd be grateful for any input. Thanks!

    Hi,
    Sorry for the late response.
    We can log off and log on again to see whether the setting gets applied.
    According to
    Policy Settings that require a reboot or logon section in the following article, this setting needs a logon.
    Deploying Group Policy Using Windows Vista
    http://technet.microsoft.com/en-us/library/cc766208(v=WS.10).aspx
    Best regards,
    Frank Shen

  • Unable to throw 'Error: A value is required' on a field from bean

    Scenario: I have an input text field and a button on a page. The input text is not required initially. I want this to be set to required after the button is clicked. So, I am doing this on the action listener of the button and returning to the page. This just returns to the page but does not throw the required error. The error is thrown the second time I click on the button(No listeners are called this time as the required property is already set). I want the error message to display immediately after clicking the button, the first time(after returning from the bean).
    Options Tried:
    I used the following in the action listener of the bean
    setValueMandatory(true); //Used this as a binding value for the required property on the input field
    textValue.setValid(false); //textValue is my input text's binding to the bean
    textValue.validate(facesContext);
    textValue.processUpdates(facesContext);
    textValue.processValidators(facesContext);
    AdfFacesContext.getCurrentInstance().addPartialTarget(textValue);
    FacesContext.getCurrentInstance().renderResponse();
    I am able to focus on the field using the cursor but unable to throw the message. Clearly, some form submit or an action need to occur on the page to render the response(or, repaint the page programmatically). But, how do I do this from the bean?
    Jdev Version: 11.1.1.4

    Divya,
    Have you tried passing the Component instead of null in my previous code?
    here is the sample i tried and it works fine.
    jspx code snippet
        <af:inputText label="Label 1" id="it1" binding="#{pageFlowScope.attributeValuesBean.rtx}"/>
        <af:commandButton text="commandButton 1" id="cb1"
                                      actionListener="#{pageFlowScope.attributeValuesBean.throwMessage}"/>backing bean snippet
        private RichInputText rtx; // add getter and setter
        public void throwMessage(ActionEvent actionEvent) {
            // Add event code here...
               FacesMessage fms = new FacesMessage("A value is required");
                fms.setSeverity(FacesMessage.SEVERITY_ERROR);
                FacesContext ctx = FacesContext.getCurrentInstance();
                ctx.addMessage(getRtx().getClientId(), fms);
        }-Arun

  • SelectManyListbox : How to set the value in the bean ?

    Hi,
    How can I set the selected values from a selectManyListbox in the bean ?
    My page:
                        <li>
                             <div class="box_multiple_selects clearfix">
                                  <div>
                                       <span>Esportes Selecionados</span>
                                       <h:selectManyListbox id="esportes_selecionados" size="10" value="artigoDetailsBean.esportes"/>
                                  </div>
                                  <div class="btns_fluxo fl">
                                       <button value="<<" name="all_right_hand">>></button>
                                       <button value=">" name="one_right_hand">></button>                                   
                                       <button value="<" name="one_left_hand"><</button>
                                       <button value="<<" name="all_left_hand"><<</button>
                                  </div>
                                  <div>
                                       <span>Esportes Cadastrados</span>
                                       <h:selectManyListbox id="esportes_cadastrados" size="10">
                                            <f:selectItems value="#{artigoDetailsBean.esporteList}" />
                                       </h:selectManyListbox>
                                  </div>
                             </div>
                        </li>
    "It´s a move right-left panel". In the right listbox are the database data, and the user click in the left arrow to move the elements (options) from right listbox to the left, and I´d like to get the selected values from the left listbox.
    The bean:
    public class ArtigoDetailsBean {
    private Collection<String> esportes;
         public Collection<String> getEsportes() {
              return esportes;
         public void setEsportes(Collection<String> esportes) {
              this.esportes = esportes;
         public List<SelectItem> getEsporteList() {
              List<SelectItem> esportes = new ArrayList<SelectItem>();
              for(Object esporte: artigoDetailsCommand.getEsporteList() ) {
                   esportes.add( new SelectItem( ((EsporteVO)esporte).getId().toString(), ((EsporteVO)esporte).getDescricao() ) );
              return esportes;
    Thanks in advance,
    Sergio Stateri Jr.
    [email protected]

    This blog shows an example of what you are trying to do - when the user clicks the left arrow it triggers an action event that puts the value into the left list, and vice-versa:
    [http://weblogs.java.net/blog/driscoll/archive/2008/11/jsf_20_the_swit_1.html|http://weblogs.java.net/blog/driscoll/archive/2008/11/jsf_20_the_swit_1.html]
    Ignore the 'JSF 2.0' in the header - it's not JSF 2.0 in this example!
    Also - don't post your email address on the forums - you might get spammed :)
    m

  • How to set hidden value in managed bean?

    Hi
    I have the following :
                           <a4j:commandButton
                                          id="commandButton3"
                                          action="#{backing_CustSearchBean.serchCustomer}"
                                          image="images/btn_search.gif"
                                          style="position: relative; margin-right: 5px;"
                                          actionListener="#{backing_CustSearchBean.checkText}"
                                          immediate="true"
                                          status="wait"
                                          oncomplete="showQuickCreate()"
                                          >  
                                <h:inputHidden id="jsfHidden" binding="#{backing_CustSearchBean.jsfHidden}" />
                                  <a4j:status id="wait">
                                    <f:facet name="start" >
                                      <h:graphicImage url="images/SpinGear2.gif" style="position: absolute; left: 378px; top: 216px; width: 19px; height: 18px;"/>
                                    </f:facet>
                                  </a4j:status>
                     </a4j:commandButton>when the action goes in the managed bean I want to set the value of hidden parameter "jsfHidden" in managed bean and catch it in showQuickCreate (oncomplete="showQuickCreate()" ) javascript function on return to the page.
    Please help, how should I do it?

    I know nothing about a4j, but if you want to pass new parameters from JSF to the backing bean, then use f:param for commandlinks or f:attribute for commandbuttons.
    The h:inputHidden just saves backing bean properties from request to request. You can't set or change it from within the JSF.
    Not sure if the f:attribute will work for the a4j commandbutton (check if they have a support forum at their website?)
    Also see http://balusc.xs4all.nl/srv/dev-jep-com.html about passing parameters and accessing objects and beans in the facescontext.

  • Having trouble setting up my website. It's probably a silly mistake.

    So I've registered a domain and hosting plan with A Simple Orange which had a pretty good deal since I had a coupon for 20% off. I've tried using Joomla to manage my website, but I couldn't get the hang of it. So I'm trying out iWeb 09' now and just having trouble setting it up. I've gone to me.com and added my website and added the CNAME correctly I hope. Here is a picture. http://imgur.com/XI8Lw.png
    Next I opened iWeb and setup MobileMe in the preferences panel. I've tried publishing the information from iWeb to my website, but my home page doesn't change. You can see here at RyanSchefer.com that it's just plan

    No. Your CNAME setting is not correct. The CNAME and web.me.com are correct with web.me.com being your host. However, your domain name is incorrect - don't understand why you have put mobileme before it? You just enter either your domain name on its own so domain.com or you need to set up two separate CNAME entries, one being for www, CNAME, web.me.com and then one being @, CNAME, web.me.com. The @ stands for your domain name and the www is your sub domain.
    Try altering this and it should work okay.

  • Having trouble setting up e-mail on new iPhone 4s. I would like to sync with my outlook mail, contacts

    I am having trouble setting up my email and syncing my outlook calendar wiht my new iphone 4s.

    How do you connect to the internet?
    Most of the time, the problem lies here. You can try a couple of things. First, try only 3G or carrier data. Then, try only wifi. If that still doesn't work, your only other option is to try a different hotspot.
    I had the same problem before when I updated to iOS 4.3. I thought it was the update at first. I usually have the carrier data turned off because my plan doesn't have an unlimited provision for it. I forgot that I also switched ISPs from DSL to a visibility unit package - meaning I had to setup my laptop so that I could get wifi from it. I realized this when I visited a friends house that I knew I could connect properly before.
    My problem was with my laptop. It seems that Little Snitch blocks the ports being used for mail and push notifications. I haven't figured it out exactly since I still can't get email when I'm using my laptop connection. But, it works fine when I'm using ONLY 3G or both/wifi only if connected to a different hotspot.
    Hope that helps.

  • Impossible to call a action handler in managed bean

    Hello! I’d developed simple jsf-application using JDeveloper 10.1.3.3 that doesn’t use faces-config.xml for a nafigation.
    Simple jsf page (page1.jspx) has only one command button:
    <af:commandButton text="commandButton 1"
    binding="#{backing_page1.commandButton1}"
    id="commandButton1"
    action="#{backing_page1.commandButton1_action}"
    immediate="true"/>
    Action is handled programmatically in managed bean Page1.java:
    public String commandButton1_action() {
    ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
    ec.redirect("page2.jspx");
    return null;
    The sample application works fine.
    Then I’d tried to use the same jsf app to develop PDK Portlet (Oracle PDK, not jsr-168). I used Portal 10.1.4 and OC4J 10.1.3.3.
    The part of provider.xml:
    <showPage class="oracle.portal.provider.v2.render.http.ResourceRenderer">
    <resourcePath>/faces/page1.jspx</resourcePath>
    </showPage>
    Action is handled programmatically in managed bean Page1.java:
    public String commandButton1_action() {
    ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
    ec.redirect("http://<hostname>:7778/portal/page/portal/SampleGroup/Sample6");
    return null;
    Unfortunately, the jsf page doesn’t call an action after submit of the button. It’s impossible to call any handler in managed bean. Although, it’s possible in usual jsf app.
    I wonder that af:goLink on the page1.jspx works fine:
    <af:goLink text="goLink 1" binding="#{backing_page1.goLink1}"
    id="goLink1"
    destination=" http://<hostname>:7778/portal/page/portal/SampleGroup/Sample6"/>
    The ask: why jsf page can’t call an action handler in managed bean in case of a portlet development?
    Thank you. Andrew

    Thank you, Frank! I’d expected an answer from you:) I and my colleagues is your big funs:)
    I’d understood Portal intercepts any event on a portal page before jsf event.
    But, it’s possible to use struts for portlet development. I’d hoped there is the same approach for Faces too (oracle.portal.provider.v2.render.http.FacesRenderer - http://www.oracle.com:80/technology/products/webcenter/files/pdk_downloads/jpdk/oracle/portal/provider/v2/render/http/FacesRenderer.html).
    WebCenter is fine product but one is expensive. May be, is there a way to develop jsf portlet outside webcenter?
    Thanks, Andrew

  • MSI X58 Pro - I'm having trouble setting up my first Raid 0 Array

    Hey guys!  I have an i7 920, X58 Pro, 3x2GB DDR3, Radeon 5850, 640GB WD Black (Windows 7 64 bit + applications) and 1TB Samsung F3 (backup) system and I'm having trouble setting up a raid 0 array.  I recently decided to purchase two additional 1TB Samsung F3 harddrives in order to create a raid 0 array, while still keeping my original two harddrives separate.  I installed the new harddrives today, installed the JMicron drivers that were on the drivers disk that came with my motherboard, went into the bios, and changed it from IDE to RAID.  I then went into the raid bios, selected the two new harddrives and selected raid 0, saved everything and tried to load Windows and Windows refuses to boot up.  I got an option to try fixing Windows but that didn't end up fixing anything.  Finally, I was forced to go back into the bios and switch it from RAID back to IDE just to get Windows to boot up again.  Does anyone know what I need to do in order to get this raid 0 to work?  Thanks a lot in advance for your help!

    Perhaps create a software RAID? You can do it in Windows through Control Panel --> Administrative Tools --> Computer Management --> Disk Management.
    A quick guide: http://www.softwaresecretweapons.com/jspwiki/windows-7-software-raid-disk-partition-and-volume-context-menus

  • How do you change the default setting for RTF documents from TextEdit to MS Word

    How do you change the default setting for RTF documents from TextEdit to MS Word, I download forms from the Canadian government and they use RTF as a standard, they are supposed to open as MS Word documents (Yes I have Office for MAC 2011) but when download the document it goes to TextEdit which messes up the form format. I can down load it right click and go "open with" MS Word but how can I get the default chnaged to save this step.

    richr604 wrote:
    Thanks I knew this, I like Safari as I want to keep everything MAC, but if I use Firefox the documents open in MS Word straight away, I was just curious if there was some setting I could change?
    In Firefox > Preferences, click the Applications tab. If RTF is there, use the pulldown menu in the Action column to pick MS Word. If RTF is not there, there are instructions here for how to add file types.

  • Trouble Setting Classpath on Windows XP

    I'm having trouble setting up a classpath on Windows XP for SDK1.3.1_04.
    I've tried Control Panel\Advanced\Environment Variables\System Variables. There was a Path variable present, to which I've added:
    c:\jdk1.3.1_04\bin;
    There wasn't a Classpath variable present though. I've tried adding it myself in System Variables as follows:
    Variable name: Classpath
    Variable value: set classpath=.;
    But no joy. When I run "set" from the command prompt, there's no classpath present.
    I'd appreciate any help.
    Cheers.

    Hi,
    I am running on XP (unfortunately), but also win2000 and win98.
    Setting up the classpath is not a problem, although if you are logged in as root, then it does not always show correctly.
    Try logging back in as yourself and then checking the classpah through the set command.
    Altrnatively, if this is not the problem, actualy try a reboot. which should not be necessary.
    best
    kev

  • Trouble setting up hp designjet 5500 printer windows 7

    Hi there i am having slight trouble setting up my hp designjet 5500 uv 60" printer as i dont have a installation disc !
    so have looked on hp site for the drivers but they are not working for some strange reason ?
    i have purchased a parralel port to usb cable and also have ethernet cable ,do i need some king of software to run the printer as i still have eprint & share from my last 42" printer i had a few years back ? but when i go to add a printer in there it cannot find it ? any help would be greatly appriciated ,thanks in advance.

    This forum is focused on consumer level products.  For the Designjet you may have better results posting in the HP DesignJet forum here, that is where the DesignJet experts can be found if the above did not resolve your issue.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

Maybe you are looking for

  • July 2nd Release

    Cristinel Anastasoaie July release - New admin user interface updates, additional customer reports and bug fixes We are announcing a new Business Catalyst release, scheduled to go live on Monday, July 2nd. With this release, we have focused on improv

  • Q's-Wiping/Reinstalling iMac G5 PPC (10.4.11) for donation

    My parents recently purchased a new 2012, 21.5” Intel Core i, iMac with OS 10.8 installed.  They wish to donate their old iMac G5 ALS PowerPC (20”) computer to a local charity. It came with OS 10.4 installed and they never upgraded, but did install a

  • My newly created fillable form is not saving the data input by applicant

    I have created a fillable form from a word document using Acrobat XI. This has been uploaded to our careers website, however, feedback from some applicants is that have completed this rather detailed application form they are unable to save the newly

  • I am very dissatisfied with the replacement phone. How do I get help?

    We purchased a casio phone, there was issues with it, and I was sent to the warranty center. They were very courteous with sending a replacement phone..but the problem was, they replaced it with a phone that was in no way comparable to the one we bou

  • When Closing the window giving error " Virtual Column not allowed"

    Hi All, In my main block, i have a button, on clicking which will open a new window(block) with a free text field to enter. I have a Save button in a new window which will save entered text fiedl and refresh the main block to see the value entered in