Javascript never invoked in jsff

hi,
the use case is in jsff, in table's row column when user presses ENTER key i need to call some methods afterwards (jdev 11.1.2.3)
for some reason i can't see javascript code invoked.
i use af:clientListener, af:serverListener pair.
actually , the example is depicted by Timo Hahn in his blog
i try to reapply it in page fragment, which doesn't contain document tag ...
below is what i tried to do and it never helped me...
please advise how to call js in page fragment
i considered Frank's blog as well, but it doesn't work in my case...
https://blogs.oracle.com/jdevotnharvest/entry/gotcha_when_using_javascript_in
<?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:trh="http://myfaces.apache.org/trinidad/html"
xmlns:f="http://java.sun.com/jsf/core">
<af:panelGroupLayout id="pgl4">
<af:panelFormLayout id="pfl1">
<trh:script id="s2">
     function handleEnterEvent(evt) {
     var _keyCode = evt.getKeyCode();
     //if (_keyCode == AdfKeyStroke.ENTER_KEY ){  
     var comp = evt.getSource();
     AdfCustomEvent.queue(comp, "EnterEvent", {}, false);
     evt.cancel();
function handleTableDoubleClick(evt){
var table = evt.getSource();
AdfCustomEvent.queue(table, "TableDoubleClickEvent",{}, true);
evt.cancel();
</trh:script>
<af:resource type="javascript">
     function handleEnterEvent(evt) {
     var _keyCode = evt.getKeyCode();
     //check for Enter Key
     if (_keyCode == AdfKeyStroke.ENTER_KEY ){  
     var comp = evt.getSource();
     AdfCustomEvent.queue(comp, "EnterEvent", {fvalue:comp.getSubmittedValue()}, false);
     evt.cancel();
</af:resource>
</af:panelFormLayout>
<af:panelBox
<af:table value="#{bindings.DcaRegisterView1.collectionModel}" var="row" width="1200"
<af:column sortProperty="#{bindings.DcaRegisterView1.hints.EffectiveUntil.name}" filterable="true"
<af:inputDate value="#{row.bindings.EffectiveUntil.inputValue}"
required="#{bindings.DcaRegisterView1.hints.EffectiveUntil.mandatory}"
columns="#{bindings.DcaRegisterView1.hints.EffectiveUntil.displayWidth}"
shortDesc="#{bindings.DcaRegisterView1.hints.EffectiveUntil.tooltip}" id="id3">
<f:validator binding="#{row.bindings.EffectiveUntil.validator}"/>
<af:convertDateTime pattern="#{bindings.DcaRegisterView1.hints.EffectiveUntil.format}"/>
     <af:clientListener method="handleEnterEvent" type="keyPress"/>
     <af:serverListener type="EnterEvent" method="#{registerBean.handleEnterEvent}"/>
</af:inputDate>
</af:column>
... page fragment code itself
</af:panelBox

The following is working for me:
The js on the page:
<af:resource  type="javascript">
        function doSomething(event) {
            alert('Doing something');
</af:resource>Calling the js from an inputText component inside a table:
<af:inputText value="#{row.bindings.FirstName.inputValue}"
                        label="#{bindings.EmployeesVOVI.hints.FirstName.label}"
                        required="#{bindings.EmployeesVOVI.hints.FirstName.mandatory}"
                        columns="#{bindings.EmployeesVOVI.hints.FirstName.displayWidth}"
                        maximumLength="#{bindings.EmployeesVOVI.hints.FirstName.precision}"
                        shortDesc="#{bindings.EmployeesVOVI.hints.FirstName.tooltip}" id="it1">
            <f:validator binding="#{row.bindings.FirstName.validator}"/>
            <af:clientListener type="keyPress" method="doSomething"/>
          </af:inputText>Have you checked any js error with - for example - firebug?
Regards,
Koen Verhulst

Similar Messages

  • SAXParser: method startElement of DefaultHandler is never invoked

    Hallo,
    I'm trying to parse following file: "<?xml version="1.0"?>
    <company>
         <staff>
              <firstname>yong</firstname>
              <lastname>mook kim</lastname>
              <nickname>mkyong</nickname>
              <salary>100000</salary>
         </staff>
         <staff>
              <firstname>low</firstname>
              <lastname>yin fong</lastname>
              <nickname>fong fong</nickname>
              <salary>200000</salary>
         </staff>
    </company>"
    I'm using class SAXParser. I have extended the class DefaultHandler. The parser runs without errors but the method startElement of handler class is never invoked. The method endElement istead is invoked normally. I'm trying to run an example from url: http://www.mkyong.com/java/how-to-read-xml-file-in-java-sax-parser/. I don't know why is this, no exception is thrown while running.
    with regards
    Rafal Ziolkowski

    The code comes from site: http://www.mkyong.com/java/how-to-read-xml-file-in-java-sax-parser/. An extraction:
         DefaultHandler handler = new DefaultHandler() {
         boolean bfname = false;
         boolean blname = false;
         boolean bnname = false;
         boolean bsalary = false;
         public void startElement(String uri, String localName,String qName,
    Attributes attributes) throws SAXException {
              System.out.println("Start Element :" + qName);
              if (qName.equalsIgnoreCase("FIRSTNAME")) {
                   bfname = true;
              if (qName.equalsIgnoreCase("LASTNAME")) {
                   blname = true;
              if (qName.equalsIgnoreCase("NICKNAME")) {
                   bnname = true;
              if (qName.equalsIgnoreCase("SALARY")) {
                   bsalary = true;
    I set breakpoint on line: System.out.println("Start Element :" + qName);
    But program never stops there. The output don't show the result of this line.
    Meanwhile I've tried to step into the parser-process and found at the class XMLDocumentFragmentScannerImpl.java following code:
    public boolean scanDocument(boolean complete)
    throws IOException, XNIException {
    // keep dispatching "events"
    fEntityManager.setEntityHandler(this);
    //System.out.println(" get Document Handler in NSDocumentHandler " + fDocumentHandler );
    int event = next();
    do {
    switch (event) {
    case XMLStreamConstants.START_DOCUMENT :
    //fDocumentHandler.startDocument(fEntityManager.getEntityScanner(),fEntityManager.getEntityScanner().getVersion(),fNamespaceContext,null);// not able to get*
    break;
    case XMLStreamConstants.START_ELEMENT :
    * //System.out.println(" in scann element");*
    * //fDocumentHandler.startElement(getElementQName(),fAttributes,null);*
    break;
    case XMLStreamConstants.CHARACTERS :
    fDocumentHandler.characters(getCharacterData(),null);
    break;
    the block for handling startElement is commented out!
    To get the SAXParser class I use following code:
         SAXParserFactory factory = SAXParserFactory.newInstance();
         SAXParser saxParser = factory.newSAXParser();
    perhaps I have to use more specific data for getting the instance of class SAXParser.
    Rafal Ziolkowski

  • Calling a javascript on load of jsff page

    I have a jsff page which is loaded as a taskflow from region.
    i tried to call an alert function on load of jsff page as follows:
    <af:clientListener type="load" method="jsMethod"/>
         <af:resource type="javascript">
         function jsMethod() {
            alert("Hi Page loaded");
    </af:resource>
    If it works fine i intent to call backing bean method from javascript later.
    the alert is not being called in this case.
    what's wrong with this method?

    Duplicate of https://community.oracle.com/thread/2617922
    Please don't ask your question multiple times!
    Timo

  • Custom Adapter for Inbound Operations never invoked

    Hi,
    I created a custom J2CA Resource Adapter for Inbound operations. I implemented javax.resource.spi.ResourceAdapter interface with all required methods - start(BootstrapContext), endpointActivation(MessageEndpointFactory, ActivationSpec), etc.
    I created the appropriate WSDL file according Adapter Development Cookbook. Below is an excerpt from it:
    <definitions targetNamespace="urn:Adapter" .......>
      <message name="Notification">
        <part name="Notification_Part" element="ns1:Svc"/>
      </message>
      <message name="Header">
        <part name="Header_Part" element="ServiceHeader"/>
      </message>
      <portType name="EventsQueue_ptt">
        <operation name="Dequeue">
          <input message="tns:Notification"/>
        </operation>
      </portType>
      <binding name="NotificationService" type="tns:EventsQueue_ptt">
        <jca:binding/>
        <operation name="Dequeue">
          <jca:operation ActivationSpec="acme.ActivationSpec"/>
          <input>
            <jca:header message="tns:Header" part="Header_Part"/>
          </input>
        </operation>
      </binding>
      <service name="EventsQueue">
        <port name="EventsQueue_pt" binding="tns:NotificationService">
          <jca:address ResourceAdapter="acme.AdapterClass"/>
        </port>
      </service>
    </definitions>I created a BPEL process with a partner link based on this WSDL and linked a Receive activity with it. According Adapter Concepts Guide here is what should happen when the BPEL process is deployed and started:
    - The ResourceAdapter class name and the ActivationSpec parameter are captured in the WSDL extension section of the J2CA inbound interaction WSDL Adapter Integration with BPEL Process Manager Adapter Integration with Oracle Application Server Components 5-7 during design time and made available to BPEL Process Manager and Adapter Framework during run time.
    - An instance of the J2CA 1.5 ResourceAdapter class is created and the Start method of the J2CA ResourceAdapter class is called.
    - Each inbound interaction operation referenced by the BPEL Process Manager processes results in invoking the EndPointActivation method of the J2CA 1.5 ResourceAdapter instance. Adapter Framework creates the ActivationSpec class (Java Bean) based on the ActivationSpec details present in the WSDL extension section of the J2CA inbound interaction and activates the endpoint of the J2CA 1.5 resource adapter.
    The problem is that start(BootstrapContext) and endpointActivation(MessageEndpointFactory, ActivationSpec) seem never to be invoked, the adapter is never initialized and at some point the Receive activity of the BPEL process times-out.
    I put some debug System.out.println statements in these methods, but nothing appeared in the server log.
    I'm using Oracle SOA Suite 10.1.3.1.
    I will be grateful for any suggestions.
    Regards,
    Simeon
    Message was edited by:
    skirov

    user9116351 wrote:
    Hi,
    I have written a custom connector for crud operations to a table in Oracle DB. The custom code class uses oracle.jdbc.OracleDriver which is present in ojdbc14.jar. I have placed this jar in ThirdParty folder of the OIM installation but I am still getting an SQLException while connecting to the DB as my custom code is unable to find the required class. Can someone guide me to some documentation that will help me get over this?
    Thanks,
    SaieshWhich version of OIM you are in? Also you dont need to copy ojdbc14.jar as this exists already in OIM.

  • How to use Javascript to invoke an action?

    Hi,
    Normally if I want to invoke a controller's action with a submit button I can use the action="#{MyController.method}" part of my JSF h:commandButton. But if I'm submitting a form through Javascript,
    document.getElementById("myForm").submit();
    how do I cause the same action to be run on the server side?
    Hope this question makes sense. Thanks, - Dave

    This is the way I do it it works for aj4:commandLink
    Here is my commandLink
    <a4j:commandLink>
    style="display:none"
    accesskey="C" action="#{manageCenter.cancel}" id="cancel_cmd" reRender="manageCenter" value="#{msg.button_CANCEL}"
    oncomplete="submitOurForm()"
    >
    </a4j:commandLink>And Here is the Javascript function to fire the event
          * Crossbrowser function to simulate click event on a component
            fireEventClick:function(elem){
                  if(typeof(elem) == "string"){
                          elem = document.getElementById ( elem );      
                  if(null == elem){
                       console.info("fireEventClick:Passed element is null");
                      return;
                 if(document.createEvent){                                                 
                     var e = document.createEvent('MouseEvents');
                     e.initMouseEvent('click', /* Event type */
                     true, /* Can bubble */
                     true, /* Cancelable */
                     document.defaultView, /* View */
                     1, /* Mouse clicks */
                     0, /* Screen x */
                     0, /* Screen y */
                     0, /* Client x */
                     0, /* Client y */
                     false, /* Ctrl */
                     false, /* Alt */
                     false, /* Shift */
                     false, /* Meta */
                     0, /* Button */
                     null); /* Related target */
                     elem.dispatchEvent(e);                     
                  }else{//IE Specific
                     elem.click();
              }So now from javascript we can simply fire the action like so and when it return we can fire our submit
    fireEventClick("cancel_cmd");Hope this helps

  • Wrapping af:resource type="javascript" to use in jsff

    hi,
    can anybody remind how to wrap an <af:resource type="javascript"> in order to let the js run in jsff?

    doesn't work , neither ...
    <?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:trh="http://myfaces.apache.org/trinidad/html"
    xmlns:f="http://java.sun.com/jsf/core">
    <trh:script id="s2">
         function handleEnterEvent(evt) {
         var _keyCode = evt.getKeyCode();
         if (_keyCode == AdfKeyStroke.ENTER_KEY ){  
         var comp = evt.getSource();
         AdfCustomEvent.queue(comp, "EnterEvent", {}, false);
         evt.cancel();
    </trh:script>
    <af:panelGroupLayout id="pgl4">
    ...a column in table...
    <af:column sortProperty="#{bindings.DcaRegisterView1.hints.EffectiveUntil.name}" filterable="true"
    width="105" sortable="true"
    headerText="#{bindings.DcaRegisterView1.hints.EffectiveUntil.label}" id="c4">
    <f:facet name="filter">
    <af:inputDate value="#{vs.filterCriteria.EffectiveUntil}" id="id2" autoSubmit="true">
    <af:convertDateTime pattern="#{bindings.DcaRegisterView1.hints.EffectiveUntil.format}"/>
    <af:clientListener method="handleEnterEvent" type="keyPress"/>
    <af:serverListener type="EnterEvent" method="#{registerBean.handleEnterEvent}"/>
    </af:inputDate>
    </f:facet>
    <af:panelGroupLayout>

  • Weird thing in SLSB in WLS, never invoke ejbCreate() or setSessionContext()

    I have this piece of code:
    public class CounterBean implements SessionBean {
         private int count;
         public void ejbCreate() {
              count = 0;
         public void ejbPassivate() {}
         public void ejbActivate() {}
         public void ejbRemove() {}
         public void setSessionContext(SessionContext sc) {
              count = 0;
         public int count() {
              return ++count;
    In weblogic-ejb-jar.xml, I have this:
    <?xml version="1.0"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic
    6.0.0 EJB//EN'
    'http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd'>
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>CounterBean
    </ejb-name>
    <stateless-session-descriptor>
    <pool>
    <max-beans-in-free-pool>2</max-beans-in-free-pool>
    <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
    </pool>
    </stateless-session-descriptor>
    <jndi-name>ejb/counter</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    My test client code is like:
    CounterBean bean1 = (CounterBean)beanHome.create();
    System.out.println(bean1.count());
    bean1.remove();
    CounterBean bean2 = (CounterBean)beanHome.create();
    System.out.println(bean2.count());
    bean2.remove();
    I have thought WLS will always invoke setSessionContext() and
    ejbCreate(), if the EJB client invoke create() method on the Home
    interface. But I always get sequentially increased result,
    1-2-3-4-5...
    Can other people verify this? Running on WLS6.1+SP2 on Win2K.
    Stateful deployment works right,
    <?xml version="1.0"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic
    6.0.0 EJB//EN'
    'http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd'>
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>CounterBean
    </ejb-name>
    <stateful-session-descriptor>
         <stateful-session-cache>
    <max-beans-in-cache>1</max-beans-in-cache>
    <idle-timeout-seconds>10</idle-timeout-seconds>
    <cache-type>LRU</cache-type>
    </stateful-session-cache>
    <persistent-store-dir>/weblogic/myserver</persistent-store-dir>
    </stateful-session-descriptor>
    <jndi-name>ejb/counter</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    It will passivate the CounterBean, and new instance, then invoke
    setSessionContext(), ejbCreate().
    Looks like, WLS doing too much caching for SLSB?
    Simon Song

    Your results are correct. The container is pooling instances. I would
    suggest that you re-read the stateless session bean lifecyle section in
    the EJB spec.
    -- Rob
    Simon Song wrote:
    I have this piece of code:
    public class CounterBean implements SessionBean {
    private int count;
    public void ejbCreate() {
    count = 0;
    public void ejbPassivate() {}
    public void ejbActivate() {}
    public void ejbRemove() {}
    public void setSessionContext(SessionContext sc) {
    count = 0;
    public int count() {
    return ++count;
    In weblogic-ejb-jar.xml, I have this:
    <?xml version="1.0"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic
    6.0.0 EJB//EN'
    'http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd'>
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>CounterBean
    </ejb-name>
    <stateless-session-descriptor>
    <pool>
    <max-beans-in-free-pool>2</max-beans-in-free-pool>
    <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
    </pool>
    </stateless-session-descriptor>
    <jndi-name>ejb/counter</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    My test client code is like:
    CounterBean bean1 = (CounterBean)beanHome.create();
    System.out.println(bean1.count());
    bean1.remove();
    CounterBean bean2 = (CounterBean)beanHome.create();
    System.out.println(bean2.count());
    bean2.remove();
    I have thought WLS will always invoke setSessionContext() and
    ejbCreate(), if the EJB client invoke create() method on the Home
    interface. But I always get sequentially increased result,
    1-2-3-4-5...
    Can other people verify this? Running on WLS6.1+SP2 on Win2K.
    Stateful deployment works right,
    <?xml version="1.0"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic
    6.0.0 EJB//EN'
    'http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd'>
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>CounterBean
    </ejb-name>
    <stateful-session-descriptor>
    <stateful-session-cache>
    <max-beans-in-cache>1</max-beans-in-cache>
    <idle-timeout-seconds>10</idle-timeout-seconds>
    <cache-type>LRU</cache-type>
    </stateful-session-cache>
    <persistent-store-dir>/weblogic/myserver</persistent-store-dir>
    </stateful-session-descriptor>
    <jndi-name>ejb/counter</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    It will passivate the CounterBean, and new instance, then invoke
    setSessionContext(), ejbCreate().
    Looks like, WLS doing too much caching for SLSB?
    Simon Song

  • KeyListener never invoked on my editor

    I am trying to make TAB go to the next field in my table. But none of my keylistener methods get invoked on my cell editor. Can anyone help? Here is my code...
    public class MultiLineCellEditor extends DefaultGridCellEditor implements GridCellEditor, KeyListener
    String value_;
    JScrollTextArea textArea_;
    CommonJSmartGrid grid_;
    public MultiLineCellEditor()
    super(new JTextField());
    JTextField jtf = (JTextField) this.getComponent();
    jtf.addKeyListener(this);
    textArea_ = new JScrollTextArea();
    value_ = null;
    setClickCountToStart(2);
    public void keyReleased(KeyEvent e)
    System.out.println("keyReleased...");
    public void keyPressed(KeyEvent e)
    System.out.println("keyPressed...");
    public void keyTyped(KeyEvent e)
    System.out.println("keytype...");
    Thanks in advance,
    Steve

    This info was helpful... however, I still can't get anything to register a keyevent once I am in the editor. The table has focus (I check) when I first open this screen, and loses focus when I double click on the cell containing the multiline cell editor. The thing is... what object then gains focus? I checked the scrollpane and the jTextField. Neither of these ever gets focus so adding a keylistener to them won't do any good. Any other ideas?
    Thanks,
    Steve

  • In a javascript function invoked from an onsubmit handler, if the function returns false, the form is still submitted. If I find an error in a form, how do I cancel the submit?

    HTML form has: action="/TTFFRP/addlicense.rex" method="get" onsubmit="validate_data();"
    validate_data is defined in tags:
    function validate_data()
    alert('in validate routine');
    if (document.getElementById('custname').value == '')
    alert('Customer name must not be blank; put in name of organization licensing File RePackager');
    return false;
    }

    Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox.
    [http://forums.mozillazine.org/viewforum.php?f=25]
    You'll need to register and login to be able to post in that forum.

  • How to invoke a plug-in menu item via Javascript?

    Hi, I installed a plug-in on my Acrobat Pro v11, it shows a plug-in menu, and there's one menu item in this plug-in menu dropdown. I can manually select that menu item and it does what it's designed to do.
    My question is, how do I use javascript to invoke it, to achieve the same result as when I manually select that menu item?
    I tried using this "app.execMenuItem("name-of-menu-item");" under my click event of a button on the PDF form, but it didn't work.
    What have I done wrong? How to make it work?
    TIA

    Thanks to all those who responded.
    Actually I got it working soon after I posted the question.
    However, I don't know, my trial&error way seems to be a little different from all those documents I read. 
    So, I am not exactly sure if it's the correct way to do this sort of thing or not.
    It certainly is not very end-user friendly IMHO.  
    I will describe what I did below, if you know of a better way, please let me know, thank you.
    First, I put a folder-level script in the Acrobat install folder, the so-called "app" level;
    because when I used the getPath("user", "javascript") call, it returned an error without giving me the user-level path. 
    Anyway, my script (the .js file) looks like this:
    xyz = app.trustedFunction(
                 function() {
                  app.beginPriv();
                  app.execMenuItem("ADBE:myxyz");
                  app.endPriv();
                  return;
    Then, on my form's button-click event, I make a call
      xyz();
    and that got it to invoke the menu item "myxyz" successfully.
    But... I can't say I like my solution:
    1) I don't like the .js file, because I'll have to put it in all my users' Acrobat install folders.
         Extremely inconvenient.
         Is there a way to make it work without using the folder level script???
    2) The script itself, I am not sure if it makes sense or not.
         I can't say I understand all these trustFunction and Security stuff;
          it just so happened that it worked for me, but I don't know why.
          so, maybe there could be a simpler script that can also work?
    3) If I put the "beginPriv()" , "execMenuItem()" and "endPriv()" lines directly in the Button-click event,
          I got an error message in the Acrobat console, something like:  "your security settings does not allow....";
          in fact, I tried many many different ways to write this Button-click script, none of them worked without the folder-level .js file.
          But I hope somebody could come up with a way to make it work without the folder-level script file....
          Is there a way to change the "security settings" without using the .js file?
    4) The execMenuItem is also a headache, sorry about complaining... but... sometimes it just silently exited without doing anything,
          and without returning any error messages... how am I supposed to know what went wrong when it's so quiet?!
           Furthermore, why does it insist on taking the full name of the menu item?  I mean, why do I must put the "ADBE:" part in there?
          there's no other menu item named "myxyz", right?
          I remember Adobe's founders once said that "making our customers' lives easier" was what drove them to work everyday.
          execMenuItem() certainly didn't listen to what they said.

  • I have a basic applet method timing problem with Firefox (and Chrome), not IE nor Opera. Works if JavaScript issues windows.alert() prior, fails otherwise.

    I have an applet method, which is invoked from a JavaScript function, that is triggered by the window.onload event. The problem seems to center in the loading of the applet and its methods.
    If I step through the 3 applet acceptance prompts (I chose to use a down-level Java), the applet method is never invoked, nor is an exception raised. How this happens is beyond my understanding.
    As additional information, the Init(), start(), and "desired" Java methods all use the synchronized keyword. This is an attempt to minimize the exposure to a multi-thread environment.
    If I issue a message from JavaScript (via window.alert()) PRIOR to invoking the method, I can get the desired results in special circumstances:
    1) When the alert is presented, Firefox also prompts, SIMULTANEOUSLY, to block/continue the applet (the first of the 3 applet acceptance prompts). I can accept that these are separate threads.
    2a) If I walk through the 3 applet acceptance prompts FIRST, and then hit the OK button on the alert message SECOND, I get the desired results, my applet method executes, and all is well (other than the fact that I would prefer not to have the alert in place at all).
    2b) If I hit the OK button on the alert message FIRST, and then walk through the 3 applet acceptance prompts SECOND, I get the same results as when the page loads WITHOUT the alert, which is the applet method is never invoked, nor is an exception raised. Weird, huh?
    The above problem only occurs when the browser and the applet's URL are loaded for the first time.
    Subsequent invocations (after the page & applet has been loaded initially) do not have the failing symptoms.
    It is my understanding that IE and Firefox (and Chrome and Opera, for that matter) each use the same implementation of JavaScript provided by Microsoft. Please correct me if this information is inaccurate.
    The failing page and it's applet are proprietary; I cannot provide the Internet URL, nor the Java or JavaScript source, to aid in your analysis.

    I can speak to the source code, but have no access to it.
    The current process/thread that invokes an applet method must check to see that the applet is not currently being loaded by another process/thread. If it is being loaded, the current process/thread should block until the load is complete, THEN attempt to invoke the applet method.
    Please forward my concern to a knowledgable developer. The nature of the problem, once identified, can be addressed in a very straightforward manner.

  • Forms don't submit when mixed w/ Javascript

    Greetings,
    I have a problem with a JSF application
    I have a JSF form with a number of text fields (h:inputText) and text areas. None are set to be required and all use the default validators, converters, etc. Each text element is bound to a String property of a backing bean. All works fine under 'normal' conditions. I submit the form, the values are all set on the backing bean, all is well.
    Next to one (or more) of the textfields, however, there is a "Select..." button (h:commandButton) with a javascript call on the 'onmousedown' event that launches a new window (this is a slightly modified version of the example found at http://forum.exadel.com/viewtopic.php?t=559 by Sergey Smirnov). The selected value in the popup window is used to set the value on the original form text field. Then the original form can be submitted.
    When I use one of these buttons to launch a new window (pop-up) with a JSF-based select list in it, I get unusual behavior. The syptoms I see are:
    1. If the popup list itself submits and refreshes (such as in the case of an indexed list, and the user selects a new index) the value is set properly on the 'opener' form, but when I submit the 'opener' form, the value reverts back to its previous (before the pop-up was launched) value.
    2. Especially with more than 1 pop-up on a form, I often see the case where I submit the form, and it simply refreshes itself, and all values are cleared from the form elements. My ActionListeners and other action events are never invoked. No messages are sent back to the page via the faces context. I get no notification of what went wrong.
    3. The behavior I get is hit or miss, sometimes it works well, other times it never works.
    4. Strangely, it seems that if I click more slowly, things tend to work better more often. Rapid clicking seems to make the failure much more likely.
    The Button looks like this:
    <h:inputText id="itemValue" value="#{item.value}"/>
    <h:inputHidden id="itemId" value="#{item.id}"/>
    <h:inputHidden id="itemTypeId" value="#{item.typeId}"/>
    <h:commandButton id="find" action="showList" value="Select..."
    onmousedown="showList(this,'itemValue', 'itemId', 'itemTypeId')"
    onclick="return false"/>
    The javascript showList() method registers the html components itemValue, itemId, and itemTypeId for callbacks, and launches a window using a pre-defined href value. Inside this window is a JSF page that lists all of the available items as h:commandLink objects. When one of the links is selected, the pop-up window calls a javascript function on the 'opener' window to set the itemValue, itemId, and itemTypeId values according to the selected item.
    function showList(action, nameFieldComponent, idFieldComponent, itemTypeIdComponent) {
    //url to the chooser.jsp file opened in the new window
    var href='<h:outputText value="#{bundle.chooser_javascript_href}" />';
    var features='<h:outputText value="#{bundle.chooser_javascript_window_properties}" />';
    <...snipped out details for brevity - resolves the form and component ids for callbacks >
    //open the new window
    winId=window.open(href,'chooserWindow',features);
    A javascript function in the chooser.jsp calls back and update() method, which sets the values on the name, id, and typeId form elements. All this works fine.
    It's AFTER all this, when I submit the form on the original page, that I get the errors.
    I suspect that somehow with more than 1 window open, I've managed to confuse the Faces navigation and view management - does anybody have any insights to help me solve the problem?
    Also, how can I better debug what is happening on the server when my action listener is never getting invoked?

    This is just a shot in the dark, but have you tried switching to client-side state saving?
    When you use server-side state saving, the JSF RI only keeps the state for one view around. If your pop-ups are created by JSF views, popping up one of them detroys the state for the main view on the server, which could cause the effects you describe. Switching to client-side state saving should solve this, because then the view state is held as hidden fields in each form instead, and hence, can't be destroyed.

  • Java script in jsff page is not working when deployed as adf lib jar

    hi,
    We have a ViewController Project with a several jsff pages that has javascript references to a .js fiile in the same project.
    When run in the same app, the javascript functions are invoked correctly.
    but, when deployed as an ADF-library and consumed in a diff application, not several components' javascript is invoked.
    Input Text Components javascript is almost always invoked. But, javascript on radio buttons or table are not invoked.
    Jdev: 11.1.1.6
    Thanks,
    Harsha.

    How to include javascript resources in  Facelet tag library

  • MYSTERY!.. action not invoked on encoded commandLink...  WHY?

    Hi All !!!
    QUESTION: How are the navigation definition (in faces-config.xml) is "wired" to a "HtmlCommandButton" I encode in my custom renderer... or any other encoded UICommand?...
    This is a mystery to me at the moment. I have not been able to find any clear explanation as to how this works -- so I've not been able to debug the issue below.
    The issue: I encode an HtmlCommandButton in my custom renderer, and add an "action" attribute bound to a backing bean method "doAction()"...
    ---But, the action method is never invoked!!!
    Again, this is primarily due to the fact that I cannot tell what "wires" the navigation definitions (in faces-config.xml) to the "action" attribute in the command button and the "doAction()" method in the backing bean.
    Please let me know what I am missing or omitting from this code to allow the "action" mechanism to work properly!! :-).
    Below is the entire test application (custom component).... The idea is to have the user click on a div tag which popluates a hidden input tag and clicks a hidden HtmlCommandButton to submit the request. The application should navigate to the same page or another page based on the value of the clicked div tag.
    ***gorm.jsp***
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://mycomponents" prefix="my"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
            <link rel="stylesheet" type="text/css" href="./stylesheet.css" title="Style">
        </head>
        <body>
            <f:view>
                <h:form id="form01">
                    <h:messages/>
                    <f:verbatim><h1>Testing custom JSF component: XYZTag:  Click on a div tag...</h1></f:verbatim>
                    <my:xyz id="xyz01" divdata="#{caveBean.divdata}" valueclicked="#{caveBean.valueclicked}" />
                </h:form>
            </f:view>
        </body>
    </html>
    ***blidge.jsp***
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://mycomponents" prefix="my"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
            <link rel="stylesheet" type="text/css" href="./stylesheet.css" title="Style">
        </head>
        <body>
            <f:view>
                <h:form id="form01">
                    <h:messages/>
                    <f:verbatim><h1>show value of the div tag that was picked...</h1></f:verbatim>
                    <h:outputText value="#{caveBean.valueclicked}" />
                    <f:verbatim><br/></f:verbatim>
                    <h:commandButton value="goback" type="submit" action="#{caveBean.doAction}"/>
                </h:form>
            </f:view>
        </body>
    </html>
    ***CaveBean.java*** (backing bean)
    package xyz;
    import java.util.*;
    public class CaveBean
        private List divdata;
        private String valueclicked;
        public CaveBean()
        public void setDivdata(List divdata)
            this.divdata = divdata;
        public List getDivdata()
            List list = new ArrayList();
            list.add("blidge");
            list.add("gorm");
            list.add("glargle");
            return list;
        public String getValueclicked()
            System.out.println("valueclicked was:" + this.valueclicked + "!");
            return this.valueclicked;
        public void setValueclicked(String valueclicked)
            this.valueclicked = valueclicked;
            System.out.println("valueclicked set to:" + this.valueclicked + "!");
        public String doAction()
            System.out.println("doAction() invoked!");
            if (valueclicked.equals("gorm"))
                return "gorm";
            else
                return "blidge";
    ***taglib (tld)***
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
      <tlib-version>0.03</tlib-version>
      <jsp-version>1.2</jsp-version>
      <short-name>mycomponents</short-name>
      <uri>http://mycomponents</uri>
      <description>mycomponent tags</description>
      <tag>
        <name>xyz</name>
        <tag-class>mycomponents.XYZTag</tag-class>
        <attribute>
          <name>id</name>
          <description>this component's id</description>
        </attribute>
        <attribute>
          <name>rendered</name>
          <description>is this component rendered?</description>
        </attribute>
        <attribute>
          <name>divdata</name>
          <description>div label strings</description>
        </attribute>
        <attribute>
          <name>valueclicked</name>
          <description>value of leaf node that was clicked</description>
        </attribute>
      </tag>
    </taglib>
    ***XYZTag***
    package mycomponents;
    import javax.faces.application.Application;
    import javax.faces.component.UIComponent;
    import javax.faces.webapp.UIComponentBodyTag;
    import javax.faces.el.ValueBinding;
    import javax.faces.context.FacesContext;
    public class XYZTag extends UIComponentBodyTag
        private String divdata;
        private String valueclicked;
        public String getComponentType ()
            return "XYZComponent";
        public String getRendererType ()
            return "XYZRenderer";
        @Override
            protected void setProperties (UIComponent component)
            super.setProperties (component);
            if( divdata != null )
                if (isValueReference (divdata))
                    FacesContext context = FacesContext.getCurrentInstance ();
                    Application app = context.getApplication ();
                    ValueBinding vb = app.createValueBinding (divdata);
                    component.setValueBinding ("divdata", vb);
                else
                    component.getAttributes ().put ("divdata", divdata);
            if( valueclicked != null )
                if (isValueReference (valueclicked))
                    FacesContext context = FacesContext.getCurrentInstance ();
                    Application app = context.getApplication ();
                    ValueBinding vb = app.createValueBinding (valueclicked);
                    component.setValueBinding ("valueclicked", vb);
                else
                    component.getAttributes ().put ("valueclicked", valueclicked);
        //setting "#{}" stuff...
        public String getDivdata ()
            return this.divdata;
        public void setDivdata (String divdata)
            this.divdata = divdata;
        public String getValueclicked ()
            return this.valueclicked;
        public void setValueclicked (String valueclicked)
            this.valueclicked = valueclicked;
        public void release ()
            super.release ();
            divdata = null;
            valueclicked = null;
    ***XYZComponent***
    package mycomponents;
    import javax.faces.component.UIComponentBase;
    import javax.faces.component.UICommand;
    import javax.faces.context.FacesContext;
    import java.util.List;
    import javax.faces.el.ValueBinding;
    public class XYZComponent extends UICommand
        private List divdata;
        private String valueclicked;
        public XYZComponent()
            setRendererType("XYZRenderer");
        public void setDivdata(List divdata)
            this.divdata = divdata;
        public List getDivdata()
            if(null != divdata)
                return divdata;
            ValueBinding _vb = getValueBinding("divdata");
            if(_vb != null)
                return (List)_vb.getValue(getFacesContext());
            else
                return null;
        // setting "#{}" stuff
        public void setValueclicked(String valueclicked, FacesContext facesContext)
            this.valueclicked = valueclicked;
            ValueBinding _vb = getValueBinding("valueclicked");
            _vb.setValue(facesContext,valueclicked);
        public String getValueclicked()
            if(null != valueclicked)
                return valueclicked;
            ValueBinding _vb = getValueBinding("valueclicked");
            if(_vb != null)
                return (String)_vb.getValue(getFacesContext());
            else
                return null;
        @Override
            public Object saveState(FacesContext context)
            Object values[] = new Object[2];
            values[0] = super.saveState(context);
            values[1] = divdata;
            values[2] = valueclicked;
            return ((Object) (values));
        @Override
            public void restoreState(FacesContext context, Object state)
            Object values[] = (Object[])state;
            super.restoreState(context, values[0]);
            divdata = (List) values[1];
            valueclicked   = (String)  values[2];
        @Override
            public String getFamily()
            return "XYZ";
    ***XYZRenderer***
    package mycomponents;
    import javax.faces.component.UIComponent;
    import javax.faces.render.Renderer;
    import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    import javax.faces.application.Application;
    import javax.faces.application.ApplicationFactory;
    import javax.faces.FactoryFinder;
    import javax.faces.component.UICommand;
    import javax.faces.component.html.HtmlCommandButton;
    import javax.faces.el.MethodBinding;
    import java.util.List;
    import java.util.Map;
    import java.util.Set;
    import java.util.Iterator;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Node;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import java.io.File;
    import java.io.IOException;
    import org.w3c.dom.Document;
    public class XYZRenderer extends Renderer
        List divdata;
        String valueclicked;
        // is there a way to derive this, rather than hardcoding???
        String divaction = "#{" + "caveBean" + ".doAction}";
        public XYZRenderer()
        @Override
            public void decode(FacesContext context, UIComponent component)
            Map requestMap = context.getExternalContext().getRequestParameterMap();
            String clientId = component.getClientId(context);
            String value = (String) requestMap.get(clientId);
            XYZComponent xYZComponent = (XYZComponent)component;
            xYZComponent.setValueclicked((String)requestMap.get(clientId + ":valueclicked"),context);
        @Override
            public void encodeEnd(FacesContext context, UIComponent component) throws java.io.IOException
            XYZComponent xYZComponent = (XYZComponent)component;
            ResponseWriter writer = context.getResponseWriter();
            String clientId  = component.getClientId(context);
            Map test = component.getAttributes();
            divdata         = (List)   component.getAttributes().get("divdata");
            valueclicked    = (String) component.getAttributes().get("valueclicked");
            Map requestMap = context.getExternalContext().getRequestParameterMap();
            //build clickable div tags
            Iterator iterator = divdata.iterator();
            while (iterator.hasNext())
                String divlabel = String.valueOf(iterator.next());
                writer.startElement("div",component);
                writer.writeAttribute("onclick", "javascript: var thisform=this; while (thisform.nodeName != 'FORM') thisform = thisform.parentNode; var valueclicked=document.getElementById('"+ clientId +":valueclicked'); valueclicked.value='" + divlabel + "'; alert('you clicked the " + divlabel + " div tag'); document.getElementById('" + (clientId +"hiddenbutton").replaceAll(":","") +  "').click();", null);
                writer.writeText(String.valueOf(divlabel) ,null);
                writer.endElement("div");
            //build hidden input field that will be populated by the value of the clicked div tag
            writer.startElement("input", component);
            writer.writeAttribute("type", "hidden", null);
            writer.writeAttribute("id", clientId + ":valueclicked", null);
            writer.writeAttribute("name", clientId + ":valueclicked", null);
            writer.writeAttribute("value", "", null);
            writer.endElement("input");
            //build hidden button, whose dom "click" method will be invoked when div tags are clicked
            writer.startElement("div",component);
            encodeHiddenButton(context, clientId, divaction);
            writer.endElement("div");
        private HtmlCommandButton createHiddenButton(FacesContext context, String clientId, String divaction)
            Application application = context.getApplication();
            HtmlCommandButton hiddenButton = (HtmlCommandButton) context.getApplication().createComponent(HtmlCommandButton.COMPONENT_TYPE);
            ApplicationFactory factory = (ApplicationFactory)FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
            MethodBinding binding = factory.getApplication().createMethodBinding(divaction,null);
            hiddenButton.setId((clientId +"hiddenbutton").replaceAll(":",""));
            hiddenButton.setType("button");
            hiddenButton.setAction(binding);
            hiddenButton.setOnclick("javascript: alert('youve clicked the new HtmlCommandButton - invisible submit button!...'); var thisform=this; while (thisform.nodeName != 'FORM') thisform = thisform.parentNode;thisform.submit();");
            hiddenButton.setValue("hiddenbutton");
            return hiddenButton;
        private void encodeHiddenButton(FacesContext context, String clientId, String divaction)
        throws IOException
            HtmlCommandButton hiddenButton = createHiddenButton(context, clientId, divaction);
            hiddenButton.encodeBegin(context);
            hiddenButton.encodeChildren(context);
            hiddenButton.encodeEnd(context);
    ***web.xml***
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
          version="2.4">
        <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>*.faces</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>30</session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>gorm.jsp</welcome-file>
        </welcome-file-list>
        <jsp-config>
            <taglib>
                <taglib-uri>/mycomponents</taglib-uri>
                <taglib-location>/WEB-INF/tlds/mycomponents.tld</taglib-location>
            </taglib>
        </jsp-config>
    </web-app>
    *** faces-config.xml***
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
       <navigation-rule>
          <from-view-id>/gorm.jsp</from-view-id>
          <navigation-case>
             <from-outcome>gorm</from-outcome>
             <to-view-id>/gorm.jsp</to-view-id>
          </navigation-case>
          <navigation-case>
             <from-outcome>blidge</from-outcome>
             <to-view-id>/blidge.jsp</to-view-id>
          </navigation-case>
       </navigation-rule>
       <navigation-rule>
          <from-view-id>/blidge.jsp</from-view-id>
          <navigation-case>
             <from-outcome>submit</from-outcome>
             <to-view-id>/gorm.jsp</to-view-id>
          </navigation-case>
       </navigation-rule>
       <managed-bean>
          <managed-bean-name>caveBean</managed-bean-name>
          <managed-bean-class>xyz.CaveBean</managed-bean-class>
          <managed-bean-scope>request</managed-bean-scope>
       </managed-bean>
        <component>
            <component-type>XYZComponent</component-type>
            <component-class>mycomponents.XYZComponent</component-class>
        </component>
        <render-kit>
            <renderer>
                <component-family>XYZ</component-family>
                <renderer-type>XYZRenderer</renderer-type>
                <renderer-class>mycomponents.XYZRenderer</renderer-class>
            </renderer>
        </render-kit>
    </faces-config>--thanks again for any help!!!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

    Hi,
    I THINK this is what you are after. You firstly shoudl add a new attribute to your component which can take a value binding expression to your bean method, this function can take any format is likes in your backing bean as long as it is public. In you tag you will then need some code similar to this:
    if(divaction != null){
             if(isValueReference(divaction )){
                    //This line here is if your function takes a single Integer arguement,
                   //you should replace it with whatever is correct for your function.
              Class[] defineParams = {Integer.class};
              MethodBinding mb = FacesContext.getCurrentInstance().getApplication().createMethodBinding(divaction , defineParams);
              ((YourComponent)component).setDivaction(mb);
             else{
              MethodBinding mb = Util.createConstantMethodBinding(divaction );
              ((RelationshipsComponent)component).setDivaction(mb);
         }And in your component you will need to add a MethodBinding variable with teh relevent getter/setter. One thing that I had a problem with here is that you must now implement the save/restore state functions or between phases the component will forget all about your methodbinding.
    private MethodBinding divaction;
    //getter/setter
    //save/restore state
    public Object saveState(FacesContext fc) {
         Object values[] = new Object[2];
         values[0] = super.saveState(fc);
         values[1] = saveAttachedState(fc, divation);
         return (values);
        public void restoreState(FacesContext fc, Object state) {
         Object values[] = (Object[]) state;
         super.restoreState(fc, values[0]);
         divaction= (MethodBinding) restoreAttachedState(fc,values[1]);
        } That saiid and done, you can move on to the renderer. I have not tried to adda button in the way in which you are, I have encoded markup directly using:
    public static void encodeButton(ResponseWriter writer, String szName, String szValue, UIComponent component) throws IOException{
         writer.startElement("input", component);
         writer.writeAttribute("type", "submit", null);
         writer.writeAttribute("name", szName, null);
         writer.writeAttribute("value", szValue, "value");
         writer.endElement("input");
        }The name element is important as it is used in the decode phase, it is the value that is stored in the requestMap if the button has been pressed.
    The decode method in your rendere is wher eyou will fire your method off, you must first check to see if your button was pressed by looking for its name in the requestMap:
    Map requestMap = fc.getExternalContext().getRequestParameterMap();
    if (requestMap.containsKey(yourButtonName)){
         //react to the button being pressed
    }You should have a method bound to your control now through the code added to your tag (and obviously on the .jsp page), all you need to do is fire it which is accomplished using the following code:
    MethodBinding mb = ((yourComponent)component).getDivaction();
              if(mb!= null){
                       //this stuff here with val is again related to your method arguements, if your method takes none, you can pass null. If you pass the wrong arguments you will get an exception telling you the function does not exist.
                  Object val[] = new Object[1];
                  Integer n = new Integer((int)rvo.getId());
                  val[0] = n;
                  mb.invoke(fc, val);
              }I know this is a different approach to that which you are using, and I daresay its not quite perfect, but it works for me!

  • I had a Javascript 'alert' box appear on a page I am developing, and clicked on the tickbox to hide further dialogue boxes from that page. Now I want to see the alert boxes again, but I can't find a way to make them appear. Please can anyone advise?

    I have tried the following so far:-
    * Restart Firefox
    * Erase all cookies for the webpage under deveopment
    * Search 'Options' for an applicable setting
    * Looked in about:config for an applicable setting

    Firefox 7.0.1 wiped out ability
    * to test JavaScript from the location bar, say goodbye to JavaScript tutorials
    * invoke JavaScript in any manner from the location bar, either directly or with a keyword shortcut.
    * resize or move windows with JavaScript
    See bug references in
    *http://kb.mozillazine.org/Resizing_oversize_window
    As a result
    *I can no longer place windows on screen where and how I want them.
    *Can no longer test/modify/fix at the location bar from code such as in the MozillaZine page above.
    Design a browser for idiots and only idiots will want to use it.

Maybe you are looking for

  • Create image of XSTRING data and display it in Web Dynpro

    Hello, I am trying to dynamically display an image in a Web Dynpro ABAP Image-Control. The problem is that the data is stored in the DB as XSTRING and I can't find a Method for example to create a new object in the MIME-Repository of the data which i

  • Photoshop work space keeps disappearing

    Every time I try to drag and drop art work from photoshop into another adobe application my photoshop window disappear and the only way i know how to get it back to quite the program. This is annoying, if I'm half way though work and this happens is

  • Fiber Channe Network

    Hello everyone, Just curious. is it possible to have an Xserve RAID volume shared accross a fiber channel network? Set up will be one RAID, 5 powermacs (all with FC cards) and connected to a fiber channel switch. Can i just share the RAID volume (wit

  • Using disk utility with Time Capsule backup disk

    When backing up, i get an error msg that tells me to run disk utility on my backup drive. It says it's having problems coping files. In Disk Utiltiy, I don't see a way to choose the time capsule backup drive but only the hard drive on my laptop. Help

  • IPhone 5 | Hotmail: Unread E-Mails

    Hello, I'm having trouble with my Hotmail account marking e-mails as unread on iPhone 5.  Looks like a real time sync problem.  How do I fix this?  Any help would be greatly appreciated. Thanks!