Calling a method in a different backing bean when I leave a different JSP

Hi,
I have an existing JPS, JspA, who's backing bean is BeanA.
JspA has an action, ActionA, called when I click "save" on JspA.
I want to include a new JspB which is launched when the user clicks "save" on JspA. I have done this with a new navigation rule. The user now does his stuff on the new JspB page and calls "exit" on this page. This calls an action on JspB's backing bean BeanB and navigation rules send the user back to JspA. Problem is I now want the old code in ActionA to execute as if JspB had never existed but not sure how to do this? I don't want the user to have to do anything else to initiate a fresh call to ActionA, I just want it to execute when navigation returns to JspA
Thanks ...

Hi,
what you say is not true. You can execute any code within a selection listener you want. If you can print then it shows the method s called and you can execute whatever you want within this method
Frank

Similar Messages

  • Calling init() method from "session scope" backing beans (AbstractPageBean)

    hi,
    i prepared a jsp/jsf page named DBmanage, its backing bean's scope is set to "session"
    the page contains - among other components - one radiobuttongroup, the buttons of which i would like to rename at the first time when the user visits the page... (default names are "item 1", "item 2", "item 3")
    i thought that the overridden init() method does the work for me with this simple code:
    import com.sun.webui.jsf.model.Option
    @override
    init() {
    rbg_default_options.setOption( new Option[]{new Option("it1", "RB1"), new Option("it2", "RB2")}
    so, let see how this code works when DBmanage backing bean's scope is "request"
    great! i see a radiobuttongroup with two buttons, named RB1 and RB2
    ok, now i change the scope to "session"
    sh&#@t!!! now i'm gazing at a page with buttons named "item 1", "item 2", "item 3"
    let's place a breakpoint inside the init() method and DEBUG... and my init() code has not run(??), how can this happen? init() method is valid only for request beans?
    pls! could anyone help me?
    ps.: i work with netbeans6.0 & glassfish
    thanks
    Gabor

    it's ok. i found out why it wasn't working.
    my scope was set to "session", but had to be "request" so that i could use the params syntax.
    thanks anyway.

  • The difference in calling an application module from a backing bean

    Hello everybody!
    I don't understand exactly, where is the difference in calling an application module from a backing bean in the following ways.
    Example 1
    FacesContext context = FacesContext.getCurrentInstance();
    ValueBinding vb = context.getApplication().createValueBinding("#{data}");
    BindingContext bc = (BindingContext)vb.getValue(context);
    DCDataControl dc = bc.findDataControl("AppModuleDataControl");
    AppModuleImpl appModule = (AppModuleImpl)dc.getDataProvider();Example 2
    String amDef = "model.services.AppModule";
    String config = "AppModuleLocal";
    AppModuleImpl appModule = (AppModuleImpl)Configuration.createRootApplicationModule(amDef, config);Example 3 (the same like Example 1???)
    String EL = "#{data.AppModuleDataControl.dataProvider}";
    FacesContext fc = FacesContext.getCurrentInstance();
    ValueBinding vb = fc.getApplication().createValueBinding(EL);
    AppModuleImpl appModule = (AppModuleImpl)vb.getValue(fc);Please can anybody explain, what the three examples do? Which example is preferred to call an application-module-method from a backing bean?
    Thanks and regards
    Majo
    Edit: I am using ADF BC 10g in JDev10 :)

    Hi :)
    >
    This could work, but can you describe the use case for which you need to get the ApplicationModule?
    Maybe we can find a better way to implement your functionality.
    >
    Sure, i know a lot of better ways to implement the same functionality too but its a huge project, its not my code and we have no time to reimplement this functions ;)
    Frank, i don't understand the first line of your code.
    DCBindingContainer bindings = ... resolve #{bindings}Where do i get the bindingContainer, if I don't have the "JSFUtils"- or "ADFUtils"-classes?
    Regards
    Majo
    Edit:
    Sorry, i have answer, before i think about it ;)
    FacesContext context = FacesContext.getCurrentInstance();
    Application app = context.getApplication();
    DCBindingContainer bindings = (DCBindingContainer)app.getVariableResolver().resolveVariable(context, "bindings");
    BindingContext bctx = bindings.getBindingContext();
    DCDataControl dc = bctx.findDataControl("AppModuleDataControl");
    AppModuleImpl am = (AppModuleImpl)dc.getDataProvider();or in my backing bean, when i add the property to the faces-config.xml
    DCBindingContainer bindings = this.getBindings();
    BindingContext bctx = bindings.getBindingContext();
    DCDataControl dc = bctx.findDataControl("AppModuleDataControl");
    AppModuleImpl am = (AppModuleImpl)dc.getDataProvider();Is this right?

  • Moving Scriptlet Code to backing bean when converting from JSP - Facelets

    Hello!
    We are converting our application from jsf1.2 to 2.0 and all jsps are being converted to XHTML. Some are trivial while others had very complex scriptlets.
    I would like to know what are some of the recommended ways of moving Scriptlet Code to backing bean when converting from JSP -> Facelets.
    I have thought about listeners, actionListeners, putting code getXXXX() of the backing bean and then calling #{bean.XXXX} but not sure whats the best way.
    I do appreciate the response!
    Eg of a jsp page:
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="/WEB-INF/xxx-jsf.tld" prefix="l" %>
    <%@ taglib uri="/WEB-INF/yyy-pp.tld" prefix="p" %>
    <%@ page import="com.ttyy.search.beans.jsf.AdvancedSearchFormManagedBean" %>
    <%@ page import="com.kkee.util.*"%>
    <%
        AdvancedSearchFormManagedBean advancedSearchFormManagedBean = (AdvancedSearchFormManagedBean) request.getSession().getAttribute("AdvancedSearchFormManagedBean");
        if (advancedSearchFormManagedBean == null) {
           advancedSearchFormManagedBean = new AdvancedSearchFormManagedBean();
           request.getSession().setAttribute("AdvancedSearchFormManagedBean", advancedSearchFormManagedBean);
        advancedSearchFormManagedBean.initializeForAdvancedSearchOptions();
        advancedSearchFormManagedBean.setQuickSearch();
         request.setAttribute("portletHeader", "Hello " + advancedSearchFormManagedBean.getPerson().getFirstname() + ", check out the latest programs in your practice areas and jurisdictions");
    %>
    <h:form id="MYCenterForm">
         <p:portletRenderer portletSetName="test of portlet"
              portletContainer="#{PortletContainerManagedBean}"
              id="MYCenter"
              portletScope = "TEST_SCOPE"
              suppressIfNoData="true"
              portletSkinName="SOME_SKIN">
              <f:facet name="persistenceToolkit">
                   <h:commandLink id="persistenceToolkitLink"
                        actionListener="#{PortletContainerManagedBean.persistPortletSetStateListener}">
                        <h:outputText value="Save State Of Portlet Set" id="persistenceToolkitLinkText"/>
                   </h:commandLink>
              </f:facet>
         </p:pagePortletSetRenderer>
    </h:form>
    <%
         String flag = PropertyItems.getInstance().getPropertyItem("response.time.flag");
         if("1".equals(flag)){
              ResponseTime rt = (ResponseTime) session.getAttribute("responseTime");
            if(rt!=null){
                rt.setDesc("my cle loaded");
                long now = System.currentTimeMillis();
                long start = rt.getStart() + rt.getTotal();
                rt.setInterval(now-start);
                rt.setTotal(rt.getTotal()+rt.getInterval());
                LogUtil.log(rt.toString(), LogUtil.DEBUG_LEVEL);
                session.setAttribute("responseTime", rt);
    %>

    That helps.
    This could be another topic question but itst kind of related to what i am doing right now. while converting JSP to facelet (in jsf2) I came across another issue.
    <h:commandLink id="Save" rendered="#{RegistrationBean.isNOTInOrigionalRegistrationMode}" action="#{RegistrationBean.updateProfile2Submit}" styleClass="#{portalSkinManagedBean.contentPortletSkin.strongTextStyle}">
              <l:htmlSkinnedImage id="SaveImage" style="border:0;" url="save.gif" alt="Save Information"/>
    </h:commandLink>When I click on the generated link, I get this. And this is happening for all the h:commandLink in the application.
    http://localhost:9080/registration/updateProfile2.jsf[request.getQueryString()=null][request.getRequestedSessionId()=F1CCE237DD81D301F1C4DBA6910FFD8A][request.isRequestedSessionIdFromCookie()=true][request.isRequestedSessionIdFromURL()=false][request.isRequestedSessionIdValid()=true]Parameters:[rolePracticeAreasForm:title=rolePracticeAreasForm:primaryPracticeArea=10002javax.faces.ViewState=-2943345291093118815:-4400303399130292206rolePracticeAreasForm:practiceAreasMod2=10148.1rolePracticeAreasForm:practiceAreasMod1=10002.1rolePracticeAreasForm:Save=rolePracticeAreasForm:SaverolePracticeAreasForm=rolePracticeAreasFormrolePracticeAreasForm:otherField=rolePracticeAreasForm:fromMyAccount=1]||
    javax.servlet.ServletException: Index: 0, Size: 0
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at com.legaledcenter.util.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:250)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at com.jscape.framework.galileo.support.upload.UploadFilter.doFilter(UploadFilter.java:71)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
         at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
         at java.util.ArrayList.RangeCheck(ArrayList.java:547)
         at java.util.ArrayList.get(ArrayList.java:322)
         at javax.faces.component.AttachedObjectListHolder.restoreState(AttachedObjectListHolder.java:161)
         at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1427)
         at com.sun.faces.application.view.StateHolderSaver.restore(StateHolderSaver.java:121)
         at com.sun.faces.application.view.StateManagementStrategyImpl$4.invokeContextCallback(StateManagementStrategyImpl.java:289)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1253)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:672)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1262)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:672)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1262)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:672)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1262)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:672)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1262)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:672)
         at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:284)
         at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
         at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:119)
         at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:434)
         at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:143)
         at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:199)
         at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
         at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
         ... 22 more
    ********** Message End *************Thanks

  • Calling a method in the backing bean when rendering a table

    I'm rendering a table that begins with :
    <h:dataTable value="#{showRooms.rooms}" var="rowRoom" ...
    There are several properties I'm displaying. Some are just displayed as they appear from the database like:
    <h:outputText value="#{rowRoom.roomNumber}"/>
    However, some I need to translate so they display a more meaningful message to the users. For example, status is stored 'A', or 'NA', but this should display 'Available' or 'Not Available'. To do this, I'm taking an idea I saw in another forum by providing a method to call and translate the text. For example:
    public String getDisplayedStatus(String status) {
    if (status.equals("A") {
    return "Available";
    } else {
    My problem is how can I invoke a method and pass in the current value of status for that row in the table. I think I need something like this:
    <h:outputText value="#{showRooms.getDisplayedStatus(#{rowRoom.roomStatus})"/>
    But that doesn't work. I can invoke the getDisplayedStatus method when passing in a hardcoded parameter, but it won't translate the value of both expressions(the method and the method param). How can I achieve this?
    Thanks,
    Mike

    Yes. I've done that and it does work....sort of. It works as long as I refer to it as 'displayStatus'. It looks up the getDisplayStatus and returns a value. The problem is getting the current status value from the object in the List. For example, the 3rd row in the table has either 'A;' or 'NA' for status. I need to know this value in order to do my translation. The way I see it, I either need
    1.)a way to call a method on the backing bean and pass the value of status from the current row into the method.
    -or-
    2.)in getDisplayStatus, I need a way to access the current row's value, perhaps through an expression. This appears to be what you can do in the AbstractPageBean class that all backing beans inherit in Studio Creator. I've seen code in a getter like 'getValue(#{currentRow.status}'), but I don't know how that is done. I looked for the source to AbstractPageBean on the web but couldn't find it - maybe its not open-source.
    Anyway, please share if anyone has a solution. I'm sure this has been done before.
    Thanks,
    Mike

  • Calling init method on backing bean when JSP loads

    Hi All,
    My problem seems simple, but I'm not having much luck finding a solution.
    I have a JSF page that shows the details of an employee. So I have an employee.jsp with a backing bean EmployeeController which works fine.
    The change I need to make is this: pass in an employeeId to the URL and let my controller read it.
    I've tried the following in my faces-config.xml:
    <managed-bean>
      <managed-bean-name>exmployeeBean</managed-bean-name>
      <managed-bean-class>
        com.acme.EmployeeController
      </managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <managed-property>
        <property-name>employeeId</property-name>
        <value>#{requestScope.employeeId}</value>
      </managed-property>
    </managed-bean>And the following in my backing bean:
    public void setEmployeeId(String employeeId) {
      logger.info("METHOD CALLED");
      this.refreshValuesForEmployee(employeeId);
    }But I'm not having any luck (ie - this method is not being called).

    it's ok. i found out why it wasn't working.
    my scope was set to "session", but had to be "request" so that i could use the params syntax.
    thanks anyway.

  • How to call the show method of Popup from backing bean?

    Hi!
    I wanted to display the results of a search form in a dialog that is placed in popup.
    That is The content of the popup will be rendered from the backing bean, dynamically .
    And so when the form is filled and the submit button is clicked, the form fields have to be submitted to the server, and the results are to be displayed in the dialog,after the PPR response has arrived, and not at the time of calling the PPR.
    Could you explain How this can be achieved?
    Samba

    Samba,
    The fix for the popup in a template is to give the template an id say "template" and reference the popup in the JavaScript as "template:popupId", where popupId is the value of the af:popup's id attribute.
    Regarding DWR, Joe really did a nice job with this framework. I have to say he got my attention. The one issue though is that JavaScript is an absolute must when using DWR and other frameworks that have a heavy JavaScript tilt. Dealing with JS can be a bit of a hassle due to x-browser idionsyncrascies as well as slow exection of JS. That said I believe Joe has one of the best JS solutions around.
    On the flip side of this ADF Faces is trying to do something a bit different. Firstly, we want to avoid JS. The user should handle as little as JS as possible. In addition,
    ADF Faces has the benefit of a server-side component framework we want to leverage this to make sure there is a limited amount of JS execution on the client.
    So if you want to work with JS, DWR is a good solution. If you want to work with, Java, standards, and a great tooling environement ADF Faces is a better choice.
    Finally, "Reverse AJAX" is a marketing term for "Push". You probably have also heard the term Comet. There are some varations on the protocols used but all-in- all. We are talking about one thing, the ability for the server to "Push" information to the client. Luckily, we provide this ability in a feature called active data channels. You will see this feature in the next preview. By setting an attribute value in a pageDef trees, tables, and BAM components can recieve data from the server via "Push".
    Thanks,
    Ric

  • Is it possible for Backing Bean to drive  the rendering of  JSP page ?

    Any thoughts on this ......
    "Backing Beans should drive the rendering of first jsp page in the application " and not jsp page driving the backing bean or not to put some kind of hard coding in jsp page to see if its admin user then display certain set of UI Components or certain set of other UI components for other users.
    As we have atleast 10 different Roles and there can be Composite Roles i.e. combination of two roles. In this case how does the Backing Bean drives the rendering just the first jsp page in the application?
    Regards
    Bansi

    You can connect to it with file sharing, but you won't be able to use it as an installation source. In other words, you won't be able to reboot the G4 and see that drive over the network to boot from it.
    If your G4's optical drive is consistently problematic, you could replace it quite easily and cheaply (if it's a desktop), or you might look at external optical drives.
    Matt

  • Problem calling Java method from JavaScript in JSP / ADF

    Hi all,
    In my JavaScript onMouseUp() function, I need to call a method on my Java backing bean. How is this done? Info on the web indicates a static Java method can be called by simply "package.class.staticMethod(...)". but when I put the statement
    "jsf.backing.GlobalRetriever.createBasemap(affectedLayer);"
    I get an error message "jsf is undefined".
    The functionality I'm trying to get is: I have a custom slider control and based on its value, I want to call oracle map viewer specifying a map extent of the (current extent / slider value) to do a zoom in/out. In addition, the slider uses a onMouseMove() function to change the size of the image display so it looks like a dynamic zoom in/out.
    Please assist or let me know if I can provide some additional information. Thanks in advance.
    Jim Greetham

    No. The Java and Javascript in a Faces application are really working in two different universes.
    Java is running on the server. It generates HTML (and sometimes even Javascript) and sends that to the client machine. That's where all your backing beans are.
    Javascript runs directly in the browser. There's no way anything on the server can have access to anything you define in Javascript, unless you explicitly send that information back to the server, either via standard form submission (which only works when someone presses a "Submit" button) or via an Ajax-type call. So otherwise, nothing you define in Javascript will ever be available to a backing bean.

  • Page Template Backing Bean Availability

    I have a page template that is used in pages across in a bounded Task flow. The backing bean is defined in the adfc-config.xml file.
    There are properties in the template backing bean that I use to determine whether to set some UI Components Visible property to true or false. So far so good and the UI Visible property is set as expected when run. e.g.
    #{backingBeanScope.beanNameBacking.myGroupAccordionVisible}
    I created another bounded Task Flow that contains a page that also references the Page Template. The new Task Flow is called from the original Task Flow.
    When I run the application now, the backing bean properties (in the Page Template) are highlighted as unknown and I get a runtime null pointer exception.
    This is even more confusing as I reference the template backing bean as a managed bean in the new (and old) Task Flow, and from the new Task Flow I can call a method in the template backing bean successfully. Why would the properties be unknown?
    Cheers.

    Hi,
    >highlighted in yellow and the hint says the bean property contained in the EL is not known
    First remove your existing EL and create EL as i said before,After create new EL it will not highlighted in yellow because EL is based on your managed Bean.

  • How to call a method in backing bean on hitting 'Enter' key on a page.

    Hi all,
    I would be obliged if any one can provide me solution for the below given problem.
    My requirement is to call a method in backing bean when i hit 'Enter' key on a JSP page.
    I am trying this by using a script given below.
    *function fnChangeFocus(){*
    *if(window.event.keyCode==13){*
    * document.getElementById("mainform:submitForm:commandbutton").focus();*
    The JSP has the textbox as given below.
    *<h:inputText id="inputtxtboxid" disabled="false" value="#{Bean.inputvalue}"*
    onkeypress="fnChangeFocus()" size="24" />
    Using this I could not acheive the required functionality. Please suggest some alternative.
    Thanks,
    Jagadeesh Pala

    Only a form element supports the submit() function. Make sure that the getElementById returns the appropriate form. Or rather pass the element as the 'this' reference to the function and get the parent form from it.
    After all this is just basic DHTML / Javascript+DOM knowledge and in fact this has nothing to do with JSF. For future basic DHTML / JS+DOM questions you may take a look at the appropriate forums, e.g. dhtmlcentral.com, dynamicdrive.com, etcetera.

  • Calling a method in a backing bean  JDev10.3.1 ADFBC

    Hi
    How can I execute a method existing in a session bean (uses a parameter) from within a method in a request backing bean?
    Thanks a lot in advance
    AG

    Maguri,
    Here some example code demonstrating how to call on a session bean. Simply lookup the session bean and call the appropriate method on the bean. This code can called from within any method within in a managed bean.
    Regards,
    Ric
    try {
    final Context context = getInitialContext();
    SessionEJB sessionEJB = (SessionEJB)context.lookup("SessionEJB");
    System.out.println( "Departments before insert: " );
    List<Departments> depts = sessionEJB.queryDepartmentsFindAll();
    for ( Departments dept:depts ) {
    System.out.println( "\tName: " + dept.getDepartmentName() + ", id= " + dept.getDepartmentId() );
    Departments newDept = new Departments();
    newDept.setDepartmentName( "Ric's 'Really Big' Department" );
    sessionEJB.persistEntity(newDept);
    System.out.println("\nDepartments after insert: ");
    depts = sessionEJB.queryDepartmentsFindAll();
    for ( Departments dept:depts ) {
    System.out.println( "\tName: " + dept.getDepartmentName() + ", id= " + dept.getDepartmentId() );
    } catch (Exception ex) {
    ex.printStackTrace();
    }

  • ADF Question: call javascript function from backing bean?

    Hi all,
    I am running JDeveloper 10.1.3.3 with ADF BC.
    Heres my situation:
    I have a table, and after inserting a new row, then committing, I want to call a javascript function. I tried using the onkeyup javascript to force a click of the save button, and then call my function after that. However, I really only want the second function to be called AFTER the commit has occurred.
    I have tried putting a setTimeout on the second function, but this never executes then. Is there some way that I can call the second javascript function from the backing bean? Is there a better workaround for this? Here is some code:
            function submitCreate(e) {
                var _event = (window.event) ? event : e;
                var KeyID = _event.keyCode;
                switch (KeyID)
                    case 13:
                        document.getElementById("form1:tvoTable:commitButton").onclick();
                        doAjax();
                        break;
            function doAjax() {
                var item = document.getElementById("form1:inputText3").innerHTML;
                getAjax(item, "FULL");
            }Thanks,
    Heather

    Maybe try adding an af:script block in your jsp as a partial target in your backing bean when you commit to the database? We are doing something similar when we get a tab DisclosureEvent but the principle should be the same.
    In our jsp we have:
    <af:script id="scriptID" text="alert('javascript here');"/>
    In the backing bean we have:
    method(DisclosureEvent de) {
    // get a component somehow or the component, we get it from the disclosure event
    // but you could use a binding also. if you don't have the exact script element you need
    // to find it like we do below.
    UIComponent c = de.getComponent();
    // Find our real script component
    UIComponent target = c.findComponent(":scriptID");
    // get the adf context
    AdfFacesContext adfContext = AdfFacesContext.getCurrentInstance();
    // add the script as a partial target.
    if(target != null) {
    adfContext.addPartialTarget(target);
    This relies on PPR though, which you may not be doing. If you are navigating to a new page you could set an indication in a backing bean and then access that in an <af:script> block in the new page or even generate the Javascript you want depending on your logic and access all of it via an EL binding on the af:script tag:
    <af:script id="scriptID" text="#{bbean.generatedScript}"/>
    Hope this helps!
    Steve

  • Calling from an EJB into a JSF Backing Bean

    Hello all,
    I'm looking for some help in making calls from an EJB into a Backing Bean (the converse is fairly straightforward). My basic question is: what is regarded as the best way to do this?
    However, for anybody who's interested, I'll describe what I've been trying...
    Here's my situation (I'm working with OC4J 10.1.3.2). I have a simple application-scoped backing bean:
       public class BackingBean implements SimpleInterface, Serializable {
           private String greeting = "Hello, World";
           private SessionEJBRemote blBeanRemote = null;
           public BackingBean() {
               // get hold of EJB
               // [ ... code to obtain EJB's remote interface snipped ... ]
               // set the callback with the EJB       
               try {
                   blBeanRemote.setCallback(this);
               } catch (Exception ex) {
                   ex.printStackTrace();
           // methods to manipulate the greeting string
           public String getGreeting() {
               return greeting;
           public void setGreeting(String greeting) {
               this.greeting = greeting;
       }SimpleInterface, which my Backing Bean implements is, well, a simple interface:
       public interface SimpleInterface {
           public void setGreeting(String greeting);
       }And my EJB is also pretty straightforward:
       @Stateful(name="SessionEJB")
       public class SessionEJBBean implements SessionEJBRemote, SessionEJBLocal {
           private SimpleInterface callback = null;
           public void setCallback(SimpleInterface callback) {
               this.callback = callback;
               callback.setGreeting("Goodbye, World");
       }Now, by using SimpleInterface, my intention was to ensure a one-way dependency: i.e. the JSF-level code would depend on the EJB-level code, but not vice versa.
    However, my experimentation has shown that when I make the call to blBeanRemote.setCallback, the parameter appears to be passed by value rather than by reference. This means firstly that, at runtime, by EJB needs to have access to my backing bean class and secondly, that the call to callback.setGreeting has no effect.
    Can anybody suggest how to work around this? Is it possible to pass the backing bean by reference? Is there a better way to achieve this callback? I appreciate that these questions might be more general Java/AppServer queries rather than JSF-specific ones - but hopefully this is something that all you JSF experts have encountered before.
    (Incidentally, I realise that what I'm doing in this example is pointless - what I'm building towards is using the ICEFaces framework to have the EJBs prod a backing bean which will in turn cause a user's browser to rerender.)
    Many thanks - any help very much appreciated!
    Alistair.

    Hi Raymond - yes, you've pretty much got that spot on: an event occurs (say receipt of a JMS message - which is spontaneous, as far as the users are concerned). As a result of that event, the client's view (in their browser) needs to be re-rendered.
    ICEFaces uses the AJAX technique to allow server-pushes, and rather than refreshing the whole page it uses "Direct-to-DOM" rendering to maninpulate the page components. If you've not come across it, and you're interested, then there are some pretty interesting demos here: http://www.icefaces.org/main/demos/ - the "chat" feature of the Auction Monitor demo (if you open it up in two browsers) is the nearest to the effect I'm looking for.
    The Auction Monitor demo uses a number of session-scoped beans, each implementing the ICEFaces "Renderable" interface, and each of which registers itself with an application-scoped bean. The application-scoped bean can thus iterate through each of the session-scoped beans and cause the corresponding browser to refresh.
    Unfortunately, in the Auction Monitor demo, the entry point is always from a browser - albeit the result is then mirrored across all connected browsers. I haven't found any examples of this processing being driven by an external event, hence my experimentation in this area!

  • How to call a method in bean from application module Impl?

    i have to call a method which is in a bean from AppmoduleImpl class. Is it possible ?

    The model layer should never depend on a specific view layer - this breaks reusability.
    What you need to do is expose a service method on your AM. Then your view can call this method and pass a parameter into the model layer.

Maybe you are looking for

  • Importing a word-document to RH11 for output as WebHelp (Image-Quality)

    Hello guys, i have a problem with importing word-documents to RH11. It is not a problem with the process itself, but with the settings. After importing the documents to RH11 the image quality is absolutly messed up. The resolution is not even half of

  • Want to assign one event to two different JSliders

    Can somebody explain how to assign one event handler to two different Jsliders?

  • A button jumping to different scenes

    Hey I created my flash website with Multiple scenes for each category/page. The problem I am having is placing the movie inside of a Button. When I put the movie clip inside of the button (I wanted a cool rollover effect) it won't jump to the frame,

  • How to wipe out the files on Time Capsule so I can sell it

    The first back up was successful, but I can't get it work ever since. The yellow light is always flashing even I follow the direction to reinstall. It's too hard for me to handle compare regular external hard drive back up. I bought a 1-TB LaCie hard

  • Cannot import pictures into Lightroom 5.6

                                       I have not been able to download into Lightroom lately.  I took a course on LR and the only thing I remember changing is that I imported into a subfolder on my desktop.  The next time I downloaded, I unchecked that