ADF BC how to access session backing bean value in servlet

Hi everyone,
How do I access session backing bean value in a servlet?

Frank, thanks for your reply.
I'm not sure how I can incorporate this example into my situation. Let me explain more detail about my problem.
"servlet" in my post here actually means a custom servlet I wrote for rendering an image that is stored in db as ordimage. In this servlet, I get hold of my appmodule by using Configuation.createRootApplicationModule(). By doing so (If I'm not wrong) a new database session/connection is created. What I'm going to achieve is set application context for this new session/connection in db with the data stored in a session backing bean in the view layer.
I can pass the required data to the servlet thru url parameter, but I don't want to do it this way for the reason that the data may contains sensitive information.
I hope I have explained myself well.
Message was edited by:
bsmt

Similar Messages

  • Something happened to my phone and lost all contacts.I did not know this and backed up my phone.When i tried to restore back up the contacts were still not there.How to access older back up?

    Something happened to my phone and lost all contacts.I did not know this and backed up my phone.When i tried to restore back up the contacts were still not there.How to access older back up?

    Her contacts would be wherever she put them
    The iphone is designed to be synced to your computer or cloud service regularly.  If she failed to do this, then they are likely gone.

  • How to call the form bean value on jsp withthe help of jstl tag

    hi
    all friends
    i am working in struts & i use jstl tag in jsp. i have one problem rise is how to call the form bean value in jsp page by using jstl tag.
    i now how to retrive the value through jsp:logic
    eg. <logic:empty name="userListForm" property="users">
    NO USER FOUND
    </logic:empty>
    see * userListForm mean formbaen name.
    * users means collection object.
    so how can i write above e.g in jstl

    You use the jstl core:if or core:choose combined with the EL:
    <c:if test="${empty users.userListForm}">
    NO USERS FOUND
    </c:if>I suggest you lookup the jsp expression language (EL) using google, it's very powerful.

  • How do I update a bean value from an AJAX call?

    Hi all,
    How do I update a bean value from an AJAX call? I suppose I could write a servlet to do it. However, this seems like a common problem, so I was wondering if there was some built in solution.
    Thanks,
    Grae
    Edited by: caalip2 on Mar 30, 2010 1:07 PM

    caalip2 wrote:
    Raymond
    Basically, I would user the following. The first choice for IE, the second for Firefox.
    new ActiveXObject("Microsoft.XMLHTTP");
    new XMLHttpRequest();
    GraeDon't do this to yourself. If it were that easy there wouldn't be AJAX frameworks for JSF. Find one you like and use it. I've used a4j (part of RichFaces) successfully.

  • Froward  bean value to servlet

    if I want to forward bean value to servlet I use
    <%@ page import="java.util.*" %>
    <html>
      <head>
    <jsp:useBean id="formHandler" class="cedars.FormBean" scope="request">
    <jsp:setProperty name="formHandler" property="*"/>
    </jsp:useBean>
    <%
       if (formHandler.validate()) {%>
    <jsp:forward page="/servlet/Insert"/>
    <% } else { %>
    <jsp:forward page="/resubmit.jsp"/>
    <% } %>
    </body>
    </html> is that right?
    why i keep get error message like NullPointerException on <jsp:forward page="/servlet/Insert"/>
    my beab local on cedars.FormBean, my Insert.java in WEB-INF/classes
    thank you for the help

    Hi,
    don't think it will execute EL this way. However,you should be able to execute JavaScript (what you should keep in mind though is that any DOM manipulation on AMX page rendering is a risk and can put you into trouble). What is the HTML you want to insert (and to what extend do you control the metadata tags added to the AMX page this way? Wouldn't it be possible to add the content using AMX components?
    Frank

  • How can a session scope bean access an application scope bean - help

    Hello,
    I have a JSP page that has references to an Application Scope and a Session Scope bean...
    <jsp:useBean id="myWebApp" scope="application" class="com.my.web.WebApplication" />
    <jsp:useBean id="myWebSession" scope="session" class="com.my.web.WebSession" />
    I would like the WebSession access methods in the WebApplication ... Can/ How does the WebSession object lookup the reference to WebApplication object?

    I don't think you should make the WebSession implement the session listener.
    The session listener will be created once, at the start of the servlet context and would be listening to all sessions. So you would have one instance of the WebSession belonging to the context (though not as an attribute), and others belonging to each session. This will be confusing in your code, I think.
    I would suggest having a different class act as the HttpSessionListener. Perhaps do something like this:
    public class WebSessionInjector implements HttpSessionListener {
      public void  sessionCreated(HttpSessionEvent e) {
        WebApplication webApp = (WebApplication)(e.getSession().getServletContext().getAttribute("webapp"));
        WebSession mySession = new WebSession();
        mySession.setWebApplication(webApp);
        e.getSession().setAttribute("mySession", mySession);
      public void sessionDestroyed(HttpSessionEvent e) { ... }
    }You may be able to use the WebApplication object itself as the listener ...
    Or, you could make the WebSession implement the HttpSessionBindingListener and use the valueBound event much like the sessionCreated event above, but from inside the WebSession object:
    public class WebSession implements HttpSessionBindingListener {
      public void  valueBound(HttpSessionBindingEvent e) {
        WebApplication webApp = (WebApplication)(e.getSession().getServletContext().getAttribute("webapp"));
        this.setWebApplication(webApp);
      public void valueUnbound(HttpSessionBindingEvent e) { ... }
    }

  • Session backing beans and multiple navigator windows sharing session

    Hi let's suppose i have a web and page1, page2 and page3 that should share the backingbean. Normal navigation goes from page 1 to page 2 to page 3.
    I do not want a backing bean per page because i need to share data between my pages. The immediate solution is to put this bean in session context and use it in each page. But this has severe drawbacks:
    - The backing bean is the same each time I access any page, and I want a new bb to be used each time the user requests for page 1
    - When a user has more than one navigator window sharing session, and on each window he is navigating through pages 1 to 3, there can be a big mess because he is accessing to the same bb from both windows.
    So I would like to find a solution that permit the user to navigate from both windows as if the windows had its own session.
    Any hint?
    Thnx

    I have a similar problem as described .
    I hava one window with enterable fields and when you click on a button it opens another window .Both forms are backed by the same bean .since both forms are nearly the same .
    The bean is a managed bean in request scope .
    when I fill in the first window with values and click on the link it opens the second but the first windows elements and now empty .
    Even though it is in Request scope when the second window is being loaded the bean is re-initialized . I would expect a new intance of this bean to be created for the second window .
    This is how I am calling the second window .
    <h:commandButton id="newRequestItem" action="#{requestItem.createNewRequestItem}" rendered="#{createActivationRequest.displayCreateLinks}" onclick="openNewPage('NewRequestItem.jsp');"
    image="images/show_all.gif" title="new request">
    <h:outputText value="new request" styleClass="toolbar-command"></h:outputText>
    </h:commandButton>
    function openNewPage(url)
         aqcbwin= window.open(url, "newRequestItem","toolbar=no, scrollbars=1");
    aqcbwin.moveTo(50, 50);
    target="_new";
    //target="_blank";
    aqcbwin.focus();
    any ideas to what is wrong and how I can correct this .
    Thanks for your help .
    Mark

  • How to access session in javabean?

    I want to access session in javabean,how can I do?

    Have something that CAN access the session pass whatever it is the bean needs to know into the bean via a setter method.

  • 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

  • How invalidate a session managed bean

    I have a faces-config. xml file with the following content:
    <managed-bean>
    <managed-bean-name>pc_mybean</managed-bean-name>
    <managed-bean-class>mybean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    For some reasons I needed to put it as session.
    Now I would like to know if there is a way to invalidate the session bean. Does someone know? How can I access to the bean with my java code?
    Thanks a lot.
    Didi

    the method to invalidate the bean:
         public static void resetManagedBean(String beanName) {
              getValueBinding(getJsfEl(beanName)).setValue(FacesContext.getCurrentInstance(), null);
         private static ValueBinding getValueBinding(String el) {
              return getApplication().createValueBinding(el);
         public static String getJsfEl(String value) {
              return "#{" + value + "}";
         }

  • How to access my backed up icloud files

    I can't seem to figure out ...how to access my i-cloud account where my files have been backed up?  I went into some i-cloud acct, but it does not have access to my files.

    You can access all your iCloud data from within the apps on your phone (contacts, calendars, etc.).  You can't access an iCloud backup except to restore it to your device.

  • ADF BC/Faces - Order of validation / backing bean action problem

    Hello,
    I want the user to enter the same "operation date" into all adf faces table rows created in one batch (one transaction).
    So I removed operation date field from the table and added "unbound" date field above the table. The date field value is then copied into all new rows in background. This process is invoked from backing bean from Commit button actionListener method.
    The problem is the validation of the operation date in entity is executed before a new date value is copied into the date attribute (validation of model is in JSF lifecycle executed prior invoking actions in backing beans).
    It means the user can enter dead lock when he enters invalid date (for example date higher then a valid value).
    Then after commit:
    1. First validation is ok (wrong date value haven't been copied into model yet)
    2. backing bean copy action is executed - model now contains wrong date value
    3. Validation before commit isn't successfult - error message is displayed
    4. User corrects the date value and presses commit again but:
    5. First validation is not successful - model still contains recent wrong date value - error message is displayed again
    6.There is no way out from this situation
    I'm going to override lifecycle to be able to invoke copy method before validation cycle. Is this solution acceptable? Do you have any other suggestion?
    Thank you.
    Rado

    hi Rado
    Would it make sense to design your ADF BC View Objects in some kind of master-detail shape that fits your data?
    View Object : OperationMaster (OperationDateAttr, ...)
    View Object : OperationDetail (OperationAttr1, OperationAttr2, ...)
    View Link : OperationDetailForMasterVL (based on some attribute that keeps the detail rows together)
    You would need some Application Module method that does the "row batch setup", but it look like your already have something like this.
    A change to OperationMaster.OperationDateAttr could update all its detail rows date attribute.
    I think that building a UI on this would be less "view layer dependant".
    Just a suggestion.
    regards
    Jan Vervecken

  • How to add a backing bean for an existing jsp

    Hi You Experts,
    I am fixing an application built by someone else. In the application, some jsps do not have the associated backing beans. Now I want to add a backing bean to go with a particular jsp so that I can write codes there. How can I do this, please?
    Thanks in advance,
    ZD

    Hi Shay (and Others),
    As such a newbie, I cannot seem to find the "little arrow" or "binding property" you mentioned. I am using jdev 10.3.3.0. After I click on a component (an af:inputText), all I see is an "Edit Binding" link at the bottom of the Property Inspector. That link actually takes me to the binding of the component and attribute in the ViewObject.
    Also, when I followed your second suggestion (Design menu -> page properties->auto bind), I got a new backing file, but it's empty. i.e., it did not capture any existing components on the jsp.
    Please help me more. Thank you very much.
    ZD

  • We should NEVER use the session back bean?

    Because the user can open a new window by right click the link, and the session scope back bean is not thread-safe.
    So we should forget it?

    Your concern makes really no sense, or you must be storing request scoped data in a session scoped bean instead of a request scoped bean, which can indeed lead to undesireable behaviour in multiple requests on the same session.

  • How to access Call Back Functions using *.dll in the Labview?

    Hai,
    I am Pavan Ram Kumar Somu.
    I am new to Labview, currently I am working on MVB Interface.
    I need to access the API functions from *.dll file in Labview, as of now , I am doing this with Call function Library node in Labview but it does not support the following data types like
        1. Pointer Arguments(To which memory it points in Labview)
        2. function pointers Arguments
        3 .pointers in structures and pointer structures in structures and many other data types.
    Please Answer the below queries also:
    1. How to pass pointer arguments to API functions in DLL and how to collect pointer  
        return types from API functions in DLL
    2. How to pass structure arguments to API functions in DLL and how to collect structure
        return types from API functions in DLL
    3. How to use callback functions(nothing but function pointers) in Labview and how to
        collect callback fuctions return types from API functions in DLL
    I need your help while passing these datatypes to API functions in DLL from labview.
    Suggest me if there is any other alternative for implementing this task.
    I am referencing some examples here:
    Examples:
    I)
    Unsigned short int gf_open_device(void *p_device_config, unsigned long int client_life_sign_timeout, unsigned short int *device_error)
    void *p_device_config: How to access/pass these arguments in LabView and to which memory location it points in LabView.
    II) #include <windows.h>
         #include <process.h>
         HANDLE rcvEvent0, rcvEvent1;
    /* Function call*/
    CanGetReceiveEvent(handle[0], &rcvEvent0);
    Above is a piece of C code, Now I want to use HANDLE datatype which is windows based, how to use these type in the LABVIEW.
    With regards
    Pavan Ramu Samu

    "Somu" <[email protected]> wrote in message news:[email protected]...
    Hai,
    I am Pavan Ram Kumar Somu.
    &nbsp;
    I am new to Labview, currently I am working on MVB Interface.
    &nbsp;
    I need to access the API functions from *.dll file in Labview, as of now , I am doing this with Call function Library node in Labview but it does not support the following data types like
    &nbsp;&nbsp;&nbsp; 1. Pointer Arguments(To which memory it points in Labview)
    &nbsp;&nbsp;&nbsp; 2. function pointers Arguments
    &nbsp;&nbsp;&nbsp; 3 .pointers in structures and pointer structures in structures and many other data types.
    &nbsp;
    Please Answer the below queries also:
    &nbsp;
    1. How to pass pointer arguments to API functions in DLL and how to collect pointer&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp; return types from API functions in DLL
    &nbsp;
    2. How to pass structure arguments to API functions in DLL and how to collect structure
    &nbsp;&nbsp;&nbsp; return types from API functions in DLL
    &nbsp;
    3. How to use callback functions(nothing but function pointers) in Labview and how to
    &nbsp;&nbsp;&nbsp; collect callback fuctions return types from API functions in DLL
    &nbsp;
    I need your help while passing these datatypes to API functions in DLL from labview.
    &nbsp;
    Suggest me if there is any other alternative for implementing this task.
    &nbsp;
    &nbsp;
    I am referencing some examples here:
    Examples:
    I)
    Unsigned short int gf_open_device(void *p_device_config, unsigned long int client_life_sign_timeout, unsigned short int *device_error)
    &nbsp;
    void *p_device_config: How to access/pass these arguments in LabView and to which memory location it points in LabView.
    &nbsp;
    II) #include &lt;windows.h&gt;
    &nbsp;&nbsp;&nbsp;&nbsp; #include &lt;process.h&gt;
    &nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp; HANDLE rcvEvent0, rcvEvent1;
    &nbsp;
    /* Function call*/
    CanGetReceiveEvent(handle[0], &amp;rcvEvent0);
    &nbsp;
    Above is a piece of C code, Now I want to use HANDLE datatype which is windows based, how to use these type in the LABVIEW.
    &nbsp;
    With regardsPavan Ramu Samu
    Search the forum (forums.ni.com) for callback, pointer or handle, and you'll find that it is all possible, but not very easy.
    e.g.: http://forums.ni.com/ni/board/message?board.id=170&message.id=88974&requireLogin=False
    Regards,
    Wiebe.

Maybe you are looking for