Groovy expression session bean managed property

Hi all
I can't establish the expression of right groovy for obtaining a value of session...
<managed-bean>
    <managed-bean-name>user</managed-bean-name>
    <managed-bean-class>ro.sinoptix.view.managed.User</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>
in my VO...
 <Variable
    Name="pid"
    Kind="where"
    Type="java.lang.String">
    <TransientExpression>
      <![CDATA[sessionScope.user.id]]>
    </TransientExpression>
  </Variable>
and the error is... Variable sessionScope unrecognized... session does not work

Thank you
PS: where can I find something on groovy in adf?

You can't do that. Managed bean reside only on the side of ViewController. You do not have access to them in the part of the model.
Expose a method in your module to request to put value on the client side to side Server and y. Alternatively, you can pass the value as a parameter to a method in the t that can then work with it.

Timo

Tags: Java

Similar Questions

  • Failed to retrieve the scope session bean

    Hello
    I'm working on JDeveloper 11.1.1.6.0.

    I use a session bean extended for the storage of information about the logged-on user. I have a page and a reading of the data of this extended session bean managed bean. It works very well. But now, I created another page also using the bean managed to read the data of the extended session bean. But he always returned null for the bean.

    Anyone has an idea why this might happen? It is not really clear to me why she is working with the first page and not with the second page, even when they both use the 'same' bean managed.

    Thanks in advance.
    Alex

    Alex,

    Kind of how convoluted to get a reference to a bean.

    Have you tried to create a managed property in the bean where is your code (set the value of the property #{SessionBean} in faces-config.) (XML)?

    John

  • [ADF, JDev12.1.3] Scope of session bean: it can contain attributes related to the Value property of user interface components?

    Hallo,

    I have a defined session bean in which I put a string attribute that is bound to the Value property of an InputText in my testPage.

    public class SessionClass {
    
      private String text;
    
      public void setText(String text) {
        this.text = text;
      }
    
      public String getText() {
        return text;
      }
    }
    

    When I run the testPage, it is not displayed.

    Perhaps this kind of linking is not possible?

    Thank you

    Federico

    Never use prefix in scope to the standard servlet scopes (request, session, application)

    So it would be: #{sessionClass.text}

    Dario

  • Does container managed entity manager is thread-safe in stateless session bean?

    Hello

    I have read JEE6 doc and confused with

    Manager managed entity containing does (injected by PersistenceContext annotation) is thread-safe in bean of stateless session in env mutiple-thread?

    See code below, if there are 2 requests to stateless session bean in 2 concurrent threads, is it using the same Instance of the managing body or not?

    @Stateless (name = "HRFacade", mappedName = "HR_FACES_EJB_JPA-HRFacade-HRFacade")

    / public class HRFacadeBean implements HRFacade, HRFacadeLocal {}

    @Resource

    SessionContext sessionContext;

    @PersistenceContext (unitName = "HRFacade")

    Private EntityManager em;

    public places (places sites) persistLocations {}
    EM. Persist (rentals);
    return places;
    }

    public places (places sites) mergeLocations {}
    Return em.merge (rentals);
    }

    {} public void removeLocations (places sites)
    location = em.find (Locations.class, locations.getLocationId ());
    EM. Remove (rentals);
    }

    / * < code > o selection of the places where < code > * /.
    @TransactionAttribute (TransactionAttributeType.NOT_SUPPORTED)
    public list < location > getLocationsFindAll() {}
    Return em.createNamedQuery ("Locations.findAll", Locations.class) .getResultList ();
    }

    }

    Yes its safe. Stateless beans would be useless if it wasn't the case. That's the bit of "controlled container" description, as long as you leave the container do its job, you don't have to worry about such details.

  • Access EJB session bean in JSF managed bean

    Components of the project: Weblogic 11 G + 12 c, 12 c EJB3 JPA 2 Jdeveloper-ADF

    I need to access EJB session bean in JSF managed bean and some methods of execution by program

    Work method and return EJB below
    Is this fair? Another way

    public static Object getEjbForDataControl (String name) {}
    BindingContainer DCBindingContainer = (DCBindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ();
    DCDataControl cDataControl = bindingContainer.findDataControl (name);
    Return cDataControl.getDataProvider ();
    }

    Thank you

    Mohsen

    Hi Isabelle,.

    I assumed that his Session EJB bean has not been exposed as a data control (my bad, didn't read any of the discussion).

    Antonis

  • [ADF, JDev12.1.3] viewScope bean can not recover sessionScope bean. Why? (How to day uploading of a session bean scope whenever a page with params is called)

    Hallo,

    to the login page of my application, I created a viewScope managed bean loginView.

    In the login page, I put a "dummy" inputText (whose value is related to dummyInitEditValue bean attr) to perform lazy loading of the page itself.

    In the initData() function I call a function of a bean sessionScope connection which should initlialize some of its attributes.

    public class LoginView {
      private Integer dummyInitEditValue;
    
      public LoginView() {
      }
    
      private void initData() {
        Login loginBean = (Login) FacesUtils.getManagedBeanInSession("login"); // loginBean = null !!!
        loginBean.initData();
        dummyInitEditValue = 1;
      }
    
      public void setDummyInitEditValue(Integer dummyInitEditValue) {
        this.dummyInitEditValue = dummyInitEditValue;
      }
    
      public Integer getDummyInitEditValue() {
        // Per lazy loading
        if (dummyInitEditValue == null)
          initData();
        return dummyInitEditValue;
      }
    }
    
    
    

    The problem is that the initData() rises a null pointer exception because the bean connection is not found.

    What's not in my approach?

    I create this hoping to resolve this issue: the login page has 2 URL parameters (defined in his point of view in the config.xml file - adfc) and I have according to them I need to update some of the bean sessionScope uploading connection every time the page is called / refreshes (possibly with new values for the parameters).

    BdW I do not know if there is a better alternative you can advice me.

    Thank you

    Federico

    Well, you need to instantiate bean connection somehow.

    You can try to link an attribute of connection bean to the page and see if this will help or you can try to resolve expression programmatically (something like #{connection}).

    Or you can try adding session bean defined as managed property for your bean view extended (something like this: http://umeshagarwal24.blogspot.ba/2012/09/using-managed-property-to-evaluate.html).

    Dario

  • Help of Bean managed using the definition

    I work to create a Managed Bean help for definition Help as described in "19.5.3 How to create the Managed Bean help ' section of the RPF Interface User Guide Developer Web ADF." With the help of JDev Version 11.1.2.1.0.

    Thought I had all of the artifacts assembled, but when I run the message is: < ELHelpProvider > < _getTranslationMap > ELHelpProvider helpSourceExpression has the value zero.

    Any suggestions would be greatly appreciated.

    Here is the managed bean:
    public class ELHelpProviderProjRequest extends ELHelpProvider {
        
        public ELHelpProviderProjRequest() {        
        }
        
        /* To use the HelpProvider, the EL expression in the helpTopicId attribute must point to a Map, otherwise
           * you will get a coerceToType error. */
    
        public Map<String, String> getHelpMap()
          {
              Iterator iterator = _HELP_MAP.entrySet().iterator();                 
              while(iterator. hasNext()){        
              System.out.println("hash map entry " + iterator.next());
               }
    
            return _HELP_MAP;
          }
         
        static private final Map<String, String> _HELP_MAP = new HashMap<String, String>(); 
            static {
              // each element [put] can be for a separate helpTopicId attribute 
              _HELP_MAP.put("MAPHELP_CATEGORY_CAPITAL_DEFINITION", "Map value for credit card definition");
              _HELP_MAP.put("MAPHELP_CATEGORY_OTHER_DEFINITION", "Map value for credit card instructions");          
            }
            
    }  
    Here's the adf - setting.xml in sources of demand / META-INF:
    <?xml version="1.0" encoding="windows-1252" ?>
    
    <adf-settings xmlns="http://xmlns.oracle.com/adf/settings" >  
      <adf-faces-config xmlns="http://xmlns.oracle.com/adf/faces/settings">
      <help-provider prefix="MAPHELP_">
        <help-provider-class>    
            com.corpnet.abc.util.ELHelpProviderProjRequest
        </help-provider-class>
        <property>
          <property-name>helpSource</property-name>
          <value>#{helpTranslationMap.helpMap}</value>
        </property>
      </help-provider>
    </adf-faces-config>  
      
    </adf-settings>
    Here are the faces-config:
    <managed-bean>
        <managed-bean-name>helpTranslationMap</managed-bean-name>
        <managed-bean-class> com.corpnet.abc.util.ELHelpProviderProjRequest </managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
    In the inputText, here is the helpTopicId component:
    <af:inputText value="Test" inlineStyle="font-weight: bold;" id="it31" simple="true" helpTopicId="MAPHELP_CATEGORY_CAPITAL" readOnly="true"/>

    The two following changes should take care of this issue:

    (1) the managed bean should not exceed ELHelpProvider, i.e.

    public class ELHelpProviderProjRequest {
    ...
    

    (2) in the adf - setting.xml use oracle.adf.view.rich.help.ELHelpProvider for the help-provider-class, i.e.

    ...
    oracle.adf.view.rich.help.ELHelpProvider
    ...
    
  • Groovy expression in the output text

    Hi all

    I want to use groovy expression in the output as text

    < af:outputFormatted value = "#{adf.currentDate}" id = "2" / > "

    < af:outputFormatted value = "#{adf.userSession.userData.user}" id = "2" / > "

    but the values are not seen at the exit and the value to the property inspector area becomes red...

    This is because groovy can be used on the side of the model. For the user interface, you use the expression language.

    For the user, you can use adfsecurity information (control http://docs.oracle.com/cd/E14571_01/web.1111/b31974/adding_security.htm#CHDFFGDJ)

    To date, you must implement a bean method that you call via EL.

    Timo

  • Session bean behaves as ask the Bean

    Hello, I met this stange behavior in my Application (JDeveloper 10.1.3.3).
    I have a jsp page that contains an element of SelectOneChoice:

    + < af:selectOneChoice inlineStyle = "margin: 10.0pt +;
    autoSubmit = "true" simple = "false".
    unselectedLabel = "sΘlectionner".
    + Binding = "#{backing_page.versionsSelectOne}" +.
    + id = 'Refresh' label = 'Versions' / > +.

    As you can see, this article is bound to a field in the bean of support for this page (which we will call the)
    Bean "PageBean"). The binding object is:

    + private CoreSelectOneChoice versionsSelectOne; +

    "PageBean" is a session, stated in faces - config.xml bean:

    + < managed-bean > +.
    + < managed-bean-name > backing_page < / managed-bean-name > +.
    + < managed-bean-class > mypackage. PageBean < / managed-bean-class > +.
    + session < managed-bean-scope > < / managed-bean-scope > +.
    + < / managed-bean > +.

    In the constructor of 'PageBean', I create a new Istance of the component:

    + Application apps = FacesContext.getCurrentInstance () .getApplication (); +
    + versionsSelectOne = (CoreSelectOneChoice) apps.createComponent (CoreSelectOneChoice.COMPONENT_TYPE); +

    The bean of support (in a method called by a button), I dynamically fill the CoreSelectOneChoice with the
    components (CoreSelectItem) I want to display in the drop-down list.

    Everything works fine BUT the "PageBean' is now recreated to * each request * (despite that it is a * Session * Bean).
    If I remove the CoreSelectOneChoice creation in the costructor, it still behaves like a Sesison Bean.
    This behavior is very strange, and it seems to be somehow connected to the CoreSelectOneChoice component.
    even if I see no Exception in my application.
    Does anyone have an idea on what is happening?

    Hi Antonio,.

    >
    (1) usually when I create a page, I can creata a support for the page bean. Can I keep the information contained in
    the bean for 4 different extended (zero, request, session, application), let'say that I am interested in session and demand.
    I thought that the components of support where like that, and JDev encourage to put then in a backing bean
    using "automatically expose UI components in a new Managed Bean. So my idea of a support of the bean internally who can manage the
    components of the user interface on the session's not going, and I have to do a new design for this application...
    Well, JDeveloper is incredibly bad on this part, so why this option is not hidden and disabled by default in 11g, unlike the step of creating the standard and active in 10 g. Normally, you very rarely use the JSF binding attribute unless the refresh PPR component, allows you to wire the values in place like EL:

    
    
    
    
    // The classes
    public class MyDataBean
    {
        private String name;
    
        public String getName()
        {
            return name;
        }
    
        public void setName(String name)
        {
            this.name = name;
        }
    }
    
    public class MyControllerBean
    {
        private MyDataBean data;
    
        public String save()
        {
            // Call the model layer to save the data in MyDataBean
            return "success";
        }
    
        public MyDataBean getData()
        {
            return data;
        }
    
        public void setData(MyDataBean data)
        {
            this.data = data;
        }
    }
    
    
    
      data
      MyDataBean
      session
    
    
      controller
      MyControllerBean
      request
      
        
        MyDataBean
        #{data}
      
    
    

    (2) I'm not here. If the component (for example CoreSelectOneChoice) class is not a managed bean of JSF,.
    How can we instantiate frame it? In any case, I had a nullpointexception if I try to set a property of the
    component (CoreSelectOneChoice) in the bean to support, without the first instantiation of it.
    You must set the properties in the binding Set accessor method:

    public class BackingBean
    {
        private CoreSelectOneChoice choice;
    
        public CoreSelectOneChoice getChoice()
        {
            return null; // safer than returning choice in case 2 pages binds on the same bean
        }
    
       public void setChoice(CoreSelectOneChoice choice)
       {
           this.choice = choice;
           this.choice.setLabel("Foo"); // Here, in the setter, NOT in the constructor so JSF instantiate the component, not you.
       }
    }
    

    (3) ok I can do it by hand, but it reminds me of something that it is done automatically by spring.
    Thanks for your reply.
    JSF 2.0 and JSR-299 allow injection using the annotation, but Spring does not automatically, you must configure the spring to do, same goes for the JSF.

    Kind regards

    ~ Simon

  • Custom attributes of access in a bean managed to webcenter 12 c

    WebCenter Portal: Webcenter 12 c

    How can I access custom attributes in a bean managed to webcenter 12 c.. ?

    I found the following blogpost to 11.1.1.8: http://blog.vassit.co.uk/knowledge/access-global-custom-attributes

    It is said to add libraries:

    • Model of WebCenter spaces
    • WebCenter spaces customer

    Cannot find these libraries in snapshot .ee 12 c.

    Update:

    The class I used in this blog post only works in 11g and it is an internal class that should be avoided to use as it may change in future versions.

    It is an example of change.

    It is offered in the Public Oracle Fusion Middleware Java QAnywhere for Oracle WebCenter Portal class WCApplicationContext that will allow you to access using Java through many steps.

    WCApplicationContext wcAppCtx = WCApplicationContext.getCurrentInstance();
    WCApplication wcApp = wcAppCtx.getApplication();
    WebCenterType wcMeta = wcApp.getApplicationConfig();
    CustomAttributes customAttr = wcMeta.getCustomAttributes();
    ...
    

    This course may not be available in the libraries provided by JDeveloper 12.2.1 and you include library webcenter-core - api .jar manually.

    I don't know why these classes are in the library and not offered public API catalog of libraries of the ADF in the JDeveloper 12.2.1

    Anyway, as suggested by the use of Vinay and his colleagues the EL Expression as he goes to work.

    Note: I'll blog in my personal blog

    Hope this information helps everybody.

    Kind regards.

  • NullPointerException when trying to data Get Session Bean in scope in an another ManagedBean

    Hello

    I used to access some data in my session bean brought a request bean so when I try to get all this data, I get

    com.sun.faces.mgbean.ManagedBeanCreationException: An error occurred performing resource injection
    on managed bean
    «discussionlaoder»


    at the end of the exception, there are

    Caused by: java.lang.NullPointerException at Hiber.discussionlaoder.init(discussionlaoder.java:35)



    This is my code:

    1 - the scope application bean

    @ManagedBean
    @RequestScoped
    public class discussionlaoder {}

    private MyadmninHelper halper;

    @ManagedProperty(value="#{serviceBean}")
    Private ServicesBean serviceBean;
    @PostConstruct
    public void init() {}
    Halper = getServiceBean () .getHalper ();  line 35

    }

    code Seter and Giraudeau

    }

    2 - the scope sessions bean

    @ManagedBean (impatient = true)
    @SessionScoped
    public class ServicesBean {}



    private MyadmninHelper halper;

    code Seter and Giraudeau

    }

    uses the glassfish 3.1 Server

    Thanks for the help

    Oky this is work I just put the attribute like this name

    @ManagedBean (impatient = true, name = "serviceBean")
    @SessionScoped
    public class ServicesBean {}

    private MyadmninHelper halper;

    code Seter and Giraudeau

    }

  • Data palette displays only not Beans managed Dynamic Web Project, JSF 2.1

    Hello.

    I have a problem in EPCO (EPCO-juno-distro - Win32.zip), where the data tab, in the Palette shows no Beans managed,.
    even though I've created in the servlet in faces-config. XML using the faces configuration editor.

    I created a dynamic Web with these facets project:
    Dynamic module Web 3.0
    1.7 Java (JDK 1.7_21)
    Support for processing Java Annotation 5.0
    JavaScript 1.0
    JavaServer Faces 2.1
    JSTL 1.2
    Oracle WebLogic Web App Extensions 12.1.1

    I use the distribution of zip 12 c 12.1.1 Oracle WebLogic Server to host the application.

    For example, I have a UserBean Managed Bean in Session scope, which has 3 fields of type string
    and the respective getters and setters.
    I create a file 'test.jspx' and palette-> tab-> JSF HTML I drag a form in
    the new file so I can connect to UserBean and generate a form to enter the details.
    I select the "generate a form tag and data content' and in the dialog box choose beans
    There is none of my beans.

    What could be the problem?

    Thanks in advance.

    Published by: 997841 on April 30, 2013 18:09
    I forgot to mention the WebLogic Web App Extensions version 12.1.1 Oracle and who also
    for JSF 2.1 Configuration Faces "subfolder" below the project in the Project Explorer is not
    non-existent, as in projects created with earlier versions of the JSF.

    Ok. We took another look at it and I think we found the problem. There is a problem with our support for JSF 2.1 in EPCO 12.1.1. This will be fixed with the version of EPCO delivered in tandem with the next version of WLS (12.1.2) that we support.

    In the meantime, if you use the JSF 2.0 instead of JSF 2.1 facet it should solve your problem. The problem with Java 1.7 looks like it may have been a Kipper.

    Unfortunately, there is no way to downgrade the version of 2.0, so you have to re-create the project. Sorry for the inconvenience. You should still be able to use libraries of 2.1 (if you want) even when the 2.0 facet is active because there is not much difference between the versions of the point of view of the tool.

    Thank you for taking the time to keep up with us and we help to find this problem.

    Thank you

    Cameron

  • Stateful session bean store module in EJB?

    Hello

    I want to use my EJB Stateful Session Bean (SFSB) module. But it seems that I can't use it because I should not inject my SFSB to a managed bean, or message driven bean (because if I do, the SFSB is communicated to all customers)

    I found that the proposed solution is to store SFSB in HttpSession.

    I'm doing this way, but I have null pointer exception.
    HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true); 
    So, how can I do this in the EJB module?

    Thank you

    Well me: hardly. Generally there is a web layer involved with a perfectly good session (or conversation) in what state can be maintained.

    Alas, you don't want to not seem to really say what is on your mind with or without my eyes so I'll offer just a hunch I have. A stateless bean remains "active" that as long as you keep a connection active IE. the reference that you are looking for or inject into your client code. The 'storage in the session bean' you refer to your first post is the Act of perpetuating the bean; as long as the reference is stored in the session you can continue to use it for the same customer without being cleaned by the container. However: when you are working from a web layer there is not a lot of use for a stateful bean because you can simply use the session itself directly to keep the substance. His personal preference if you use them or not really.

    Where you were going wrong in your initial post, is that you get the the HTTP session object in your EJB code. But you probably already figured out for yourself.

  • Cluster server: Replication Session bean

    I use JDeveloper 11.1.1.6.0

    I am currently developing our application for a clustered environment, and I was following section 20.4.3 the following document: http://docs.oracle.com/cd/E23943_01/web.1111/b31974/web_getstarted.htm#CHDIJCIE

    The document mentions that I need to make the beans of sight, pageflow and session as "serializable" and this bean pageflow view range shall be marked as dirty when they are updated. However, session bean did not have to be marked. I have to do something else in order to ensure that changes to the scope of the session is replicated in the cluster? ADF or somehow detect that there is a change and manage this replication for me?

    Thank you.

    The reason why you only need to do this for the beans to view range and pageflow is the way in which they are stored. These scopes are stored as cards in the scope of the session. If you change a bean inside the scope of session card don't know it because she knows that the reference and value.
    Changes to the session scope objects are tracked by the framework.

    Timo

  • How to set the session bean of backing bean variable

    Hi all -

    I have a bean with a session variable and I want to set the value of this variable to a bean of support. Could someone please suggest how to achieve this.

    I use ADF 11 g.

    Greetings-
    Rohit

    Hello

    First of all, you need get the referral of bean in the bean to support session, and call the method that sets the value of the attribute. Getting session bean reference - you can use dependency injection, which is the best way, but you must register your bean in faces-config. XML (not adfc - config.xml, see http://biemond.blogspot.com/2010/04/ejb-injection-in-jsf-managed-bean.html).
    An alternative is to search the session bean's JNDI.
    Third option involves data controls: you create a session bean data control and then expose the method to fix your attribute value, in the calling page to jspx pageDef. To do this, you can't use method that begins with 'set', because you will not be able to exhibit in the pageDef (at least not with the Visual Editor). Then, you can call this method from the bean to support using this code:

            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
            OperationBinding operationBinding = bindings.getOperationBinding("yourSessionBeanMethodExposedInPageDef");
            operationBinding.execute();
    

    I hope this helps.
    Pedja

Maybe you are looking for