Problem injecting a List of managed beans in JSF framework.

Is it possible to inject a List of beans as a managedproperty to a managed bean??
@ManagedProperty(value="#{user}")
     private List<userBean> users;
Thanks.

It was possible through faces-config, so I'd say yes. Are you sure 'user' actually resolves into a list? Perhaps you meant 'users' ?

Similar Messages

  • How am I able to use an injected EJB in a Managed Bean Constructor?

    JSF 1.2
    EJB 3.0
    Glassfish v1
    Summary:
    Managed bean injected EJB is null when referencing EJB var in constructor.
    Details:
    In my managed bean, I have a constructor that tries to reference an injected EJB, such as:
    public class CustomerBean implements Serializable {
    @EJB private CustomerSessionRemote customerSessionRemote;
    public CustomerBean() {
    List<CustomerRow> results = customerSessionRemote.getCustomerList();
    }The call within the constructor to customerSessionRemote is null - I've double checked this in Netbeans 5.5.
    How am I able to use an injected EJB in a Managed Bean Constructor?
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    OK, I was reading the article Web Tier to Go With Java EE 5: A Look at Resource Injection and I understand your statement too.
    Is there any way possible to Inject the EJB prior to the bean instance creation at all?
    Maybe, I need to approach it with the old fashion Java EE 1.4 route and using JNDI in the PostConstruct annotated method to reference the EJB in the managed bean.
    This had to been thought out before, I don't understand why a manged bean's life cycle places any injections at the end of the bean creation.
    Also, now that I understand that the @PostConstruct annotated method will be called by the container after the bean has been constructed and before any business methods of the bean are executed.
    I am trying to reference my EJB as part of the creation of the managed bean.
    What happens: the JSF page loads the managed bean and I need to populate a listbox component with data from an EJB.
    When I try to make the call to the EJB in the listbox setter method, the EJB reference is null.
    Now, I'm not for sure if the @PostConstruct annotation is going to work... hmmmm.
    ** Figured it out. ** I just needed to move the EJB logic that was still in the setter of the component I wanted to populate into the annotated PostConstruct method.

  • How to forward to another page when checking session managed bean in jsf 2

    When I do it in jsp page I write:
    <c:if test="${sessionScope.role != 'user'}">
        <jsp:forward page="login.jsp" />
    </c:if>And in jsf 2.0 I use ManagedBean as session and I want to check session in per page. But I cannot do it in jsf 2.0 (.xhtml). Please help me. Thanks
    Edited by: tuanbs on May 12, 2010 1:19 AM

    I included this code in the PartnerManagementBean.java:
         public class PartnerManagementBean {
         protected List<SelectItem> partners;
    //other properties....
    public String addPartner() {
    // code to insert new partner into db
    // Add the newly added partner to the partner list
              addToPartnerList(partnerBO);
              FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove("PartnerManagementBean");
              FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("PartnerManagementBean");
    Still, the new partner added is not reflecting in the session variable and hence it is not reflecting when I look for the new partner in "Modify Partner" page.
    What could be the solution ?

  • EJB Injection in Seperated Managed Bean

    Hi All,
    I have a JSF project consisting of a number of different WARs, containing the Web logic, and a bunch of different JARs, containing the application logic; which are deployed together in a single EAR file. Thus far this approach has worked excellently, but I've now run into a problem. I would like to have a managed session-scoped bean which should be available to all the WARs' classes so that they can store cross-application data in it (for example the user's name and other details). I can do this by packaging that session-scoped bean, along with its faces-config.xml, into a JAR which is deployed through the EAR. This works fine, but EJB Injection in that session-scoped bean doesn't work - my bean interface instance always contains null.
    Is there someway that I can have EJB Injection in this managed session-scoped bean contained in a JAR? I realize that EJB Injection requires a container, but seeing as it is a managed bean, even though it isn't inside a WAR, I thought this should work fine?
    Thank you,
    Ristretto

    We tried almost every permutation and combination, but it did not work without that dummy servlet.
    Then we had to look for a cleaner solution and we found one.
    We are now using spring injection, to get the EJB injection in our session managed bean. This way the code is extensible and cleaner.
    In future if you want something else(other than ejb lets say a web service), you will just change the Spring config file and it would't break anything.
    Edited by: desu on Mar 14, 2008 4:20 AM

  • JSF1063 Warning With Managed Bean

    With Glassfish V3 it outputs a JSF 1063 warning to do with not being able to serialise an object. Below is the Glassfish log:
    INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
    INFO: nullID: /home/nick/NetBeans Projects/EAA Website/build/web/ CLASSES: [class nz.co.eaa.FeedbackController, class nz.co.eaa.ServicesController, class nz.co.eaa.Feedback, class nz.co.eaa.ApplicationController]
    INFO: Initializing Mojarra 2.0.2 (FCS b10) for context '/eaa'
    INFO: Monitoring jndi:/server/eaa/WEB-INF/faces-config.xml for modifications
    INFO: Loading application EAA_Website at /eaa
    INFO: EAA_Website was successfully deployed in 746 milliseconds.
    WARNING: JSF1063: WARNING! Setting non-serializable attribute value into HttpSession (key: feedback, value class: nz.co.eaa.Feedback).What is really bizarre is that the managed bean (Feedback) is session scoped, therefore it should be serialised across a session (HTTP session). Also the managed bean has a null ID which may contribute to the problem. Here are the contents of Feedback.java:
    package nz.co.eaa;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.SessionScoped;
    @ManagedBean(name = "feedback")
    @SessionScoped
    public class Feedback
        private String firstName = "";
        private String lastName = "";
        private String email = "";
        private String phoneNum = "";
        private String address = "";
        private String subject = "";
        private String message = "";
        private String priority = "";
        /** Creates a new instance of Feedback */
        public Feedback()
            // Do nothing.
        public String getAddress()
            return address;
        public void setAddress(String address)
            this.address = address;
        public String getEmail()
            return email;
        public void setEmail(String email)
            this.email = email;
        public String getFirstName()
            return firstName;
        public void setFirstName(String firstName)
            this.firstName = firstName;
        public String getLastName()
            return lastName;
        public void setLastName(String lastName)
            this.lastName = lastName;
        public String getMessage()
            return message;
        public void setMessage(String message)
            this.message = message;
        public String getPhoneNum()
            return phoneNum;
        public void setPhoneNum(String phoneNum)
            this.phoneNum = phoneNum;
        public String getPriority()
            return priority;
        public void setPriority(String priority)
            this.priority = priority;
        public String getSubject()
            return subject;
        public void setSubject(String subject)
            this.subject = subject;
    }Here are the contents of feedback.xhtml:
    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:f="http://java.sun.com/jsf/core">
        <ui:composition template="layout.xhtml">
            <ui:define name="content">
                <h1 id="content-title">Feedback</h1>
                <f:view>
                    <h:form>
                        <h:outputLabel value="#{feedbackController.labelNames['firstName']}"
                                       for="firstName" />
                        <h:inputText id="firstName"
                                     value="#{feedback.firstName}" />
                        <h:outputLabel value="#{feedbackController.labelNames['lastName']}"
                                       for="lastName" />
                        <h:inputText id="lastName"
                                     value="#{feedback.lastName}" />
                        <h:outputLabel value="#{feedbackController.labelNames['email']}"
                                       for="email" />
                        <h:inputText id="email"
                                     value="#{feedback.email}" />
                        <h:outputLabel value="#{feedbackController.labelNames['phoneNum']}"
                                       for="phoneNum" />
                        <h:inputText id="phoneNum"
                                     value="#{feedback.phoneNum}" />
                        <h:outputLabel value="#{feedbackController.labelNames['addr']}"
                                       for="addr" />
                        <h:inputTextarea id="addr"
                                         value="#{feedback.address}" />
                        <h:outputLabel value="#{feedbackController.labelNames['subject']}"
                                       for="subject" />
                        <h:selectOneListbox value="#{feedback.subject}"
                                            id="subject">
                            <f:selectItems var="item" itemLabel="#{item}"
                                           itemValue="#{item}"
                                           value="#{feedbackController.subjects}"/>
                        </h:selectOneListbox>
                        <h:outputLabel value="#{feedbackController.labelNames['msg']}"
                                       for="msg" />
                        <h:inputTextarea id="msg"
                                         value="#{feedback.message}" />
                        <h:outputLabel value="#{feedbackController.labelNames['priority']}"
                                       for="subject" />
                        <h:selectOneListbox value="#{feedback.priority}">
                            <f:selectItems var="item" itemLabel="#{item}"
                                           itemValue="#{item}"
                                           value="#{feedbackController.priorities}"/>
                        </h:selectOneListbox>
                    </h:form>
                </f:view>
            </ui:define>
        </ui:composition>
    </html>Currently when feedback.xhtml is visited nothing is saved to the HTTP session even though feedback's properties are bound to the JSF controls in feedback.xhtml. Has anyone encountered a similar problem where a session scoped managed bean is not persisted in a HTTP session?

    Interesting that the container would attempt to persist a session to disk, or some other persistent storage if the session times out. This would explain why there was a warning message that appeared in the Glassfish log. Below is the contents of FeedbackController.java:
    package nz.co.eaa;
    import java.util.HashMap;
    import java.util.Map;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.NoneScoped;
    @ManagedBean(name = "feedbackController")
    @NoneScoped
    public class FeedbackController
        private Map<String, String> labelNames = new HashMap<String, String>();
        private String[] subjects = {"Inquiry", "Comment", "Quotes"};
        private String[] priorities = {"Low", "Medium", "High"};
        /** Creates a new instance of FeedbackController */
        public FeedbackController()
            labelNames.put("firstName", "First Name:");
            labelNames.put("lastName", "Last Name:");
            labelNames.put("email", "Email:");
            labelNames.put("phoneNum", "Phone Number:");
            labelNames.put("addr", "Address:");
            labelNames.put("subject", "Subject:");
            labelNames.put("msg", "Message:");
            labelNames.put("priority", "Priority:");
        public String[] getPriorities()
            return priorities;
        public String[] getSubjects()
            return subjects;
        public Map<String, String> getLabelNames()
            return labelNames;
    }As for FeedbackController it is set for None scope since some data is contained within the managed bean itself. All data bindings to the FeedbackController are receiving the correct values so this isn't the actual issue. The real issue is data not being retrieved from Feedback when it is filled with data (supposedly), hence all form data is lost when feedback.xhtml is refreshed.
    Although this may not be needed I have included the contents of web.xml below just in case:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
        <context-param>
            <param-name>javax.faces.PROJECT_STAGE</param-name>
            <param-value>Development</param-value>
        </context-param>
        <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>faces/index.xhtml</welcome-file>
        </welcome-file-list>
    </web-app>

  • How to use a managed bean in a bounded task flow without definig it in adfc-config

    Dear all
    I create a bounded task flow without page fragments (the pages are jspx), i created a jspx page with a button that its action has bounded to a managed bean function.
    i defined the managed bean on the corresponding bounded task flow, but it does not work.
    But there is no problem when i define the managed bean in adfc-config.xml.
    can anybody help me with this problem.
    is it possible to use jspx page with backing bean in bounded task flows, without defining the beans on adfc-config?
    Thank you very much

    Dear Timo
    I use jDev 11.1.1.6 and the scope is Request.Although when i use task flow page fragment and create jsff pages, there is no problem.

  • Accessing facade bean in ADF Faces managed bean

    Hello
    I am trying to display data from a database on a page using ADF Faces. I am using a Web Application [JSF, EJB] template in JDeveloper with the model project using JPA entities with a session facade bean to manage the entities (as described here: http://www.oracle.com/technology/obe/obe1013jdev/10131/ejb_and_jpa/master-detail_pagewith_ejb.htm ).
    What I have tried to do is to set up a managed session bean in the ViewController project that is referenced by a faces page. The managed bean is supposed to, on creation, load data from the database into managed properties which are then displayed on the faces page using EL references. I want all JPA management to go through the facade, and thus I want to inject the facade bean into the managed bean using @EJB notation. However, the injection does not work, and all I get is a NullPointerException when trying to access the injected facade in the managed bean.
    I have also tried instantiating the facade bean in the managed bean's constructor manually, but when I try to call a method on the facade, I get another NullPointerException, this time from the entity manager which obviously is not injected into the facade bean.
    What is strange is that the facade bean works perfectly when I use the datacontrols generated from the facade bean, as described in the tutorial (no exception from the entity manager).
    I have searched high and low for a solution to this, and from what I can read, it should be possible to do what I want (see for example https://blueprints.dev.java.net/bpcatalog/ee5/persistence/ejbfacade.html and http://luxlog.wordpress.com/2007/12/15/basic-example-web-app-with-glassfish-netbeans-60-jsf-and-ejb3/ ). I found someone mentioning that dependency injection in the web container OC4J was added after a given version, and that web.xml needs to be upgraded to version 2.5, which I have done but did not solve anything.
    Is this not possible in JDeveloper/OC4J at all? Is there any other way to access the facade session bean in managed beans?

    Hi,
    for resource injection you need JDeveloper 11. Here the EJB annotation works to inject the resource. If you want to do similar in 10.1.3 then you need to do a JNI lookup in the managed bean (under the shelves ADF does the same)
    Frank

  • Using managed bean method in expression builder

    Hello,
    I'm new to adf and I have the following problem.
    I have a managed bean in session scope that has the following method:
    public boolean alertMessages() throws NamingException,
    SQLException {
    if (condition)
    {  return true;}
    else
    {return false;}
    I have a page that has a link. Using the expression builder and according the function result I want to make the link bold or not.
    I use the expression #{sessionScope.backing_pages_index.alertMessages ?'bold':'normal'} but it does'n work.
    Could anybody help me.
    Thank you,

    Hi..
    If you add your bean as sessionScope No need to add sessionScope to EL front,and should setter and getter for alertMessages
    use *font-weight:#{backing_pages_index.alertMessages ? 'bold':'normal'}*
    try as follows it is working for me
    > private boolean alertMessages;
    > public void setAlertMessages(boolean alertMessages) {
    > this.alertMessages = alertMessages;
    > }
    > public boolean isAlertMessages() {
    > if (true) {
    > return true;
    > } else {
    > return false;
    > }
    > }
         <af:commandLink text="commandLink 1" id="cl1" action="CustomPage"> inlineStyle="font-weight:#{backing_pages_index.alertMessages ? 'bold':'normal'};"/>

  • JSF managed beans Vs Enterprise beans

    Hi friends,
    what are the advantages/disadvantages of using enterprise beans/ JSF managed beans over JSF managed beans/Enterprise beans
    regards
    san

    The primary difference between managed bean and enterprise bean is : enterprise bean will avail all the services provided by EJB container. where as managed bean cant avail all these.

  • Double click on menu = exception : managed bean problem ?

    Hello,
    I am a beginner with JSF and I have to work on an existing project.
    In my Web application, my problem is that if the user doubles click on some navigation links, then an exception is raised.
    Technically, I think that 2 consecutive HTTP requests sent to the server enter in competition and thus the state of certain variables becomes inconsistent. This problem appears when the 2nd click is sent to the server before the server answered the treatment of the 1st click.
    My current assumption is directed towards the managed beans used in the application (I am not (yet ;) ) a master on the subject). In fact, the main menu is �attached� to managed bean which are all of type �session�. At the time of the creation of the bean, a certain quantity of treatment is done to prepare information to be posted on the page. Other treatments are obviously done during the treatment of page JSF (Java code called by JSF of the).
    I think that at the time of the first call, the managed bean is possibly initialized. At the time of the 2nd click on the page, this bean re-initialized or is simply removed if the user has clicked on another menu (which refers to another bean).
    Would you have an idea of the veracity of my assumption?
    Would you have an idea how to solve the problem?
    I am currently looking for a JavaScript which allows me to disable all buttons on the page before the complete response of the server (that in order to prevent the user from clicking on an action before its preceding action is not treated).
    Thank you in advance for your help and all your ideas !

    mharelick wrote:
    the trash can icon is still having crashes.
    Launch the Terminal utility and type this command, each followed by the "return" key:
    ls -lad .Trash
    ls -la .Trash
    The "l" in those commands is the lower-case letter "L".
    The first command shows you the ownership and permissions of the .Trash folder. On my system my user "short name" is listed as the owner and group. The permissions are "drwx------".
    The second command shows you any files within the .Trashes folder. (Ignore the entries ending in one and two periods.) You should be the owner of anything in it. The permissions on anything there should start with "-rw" or "drw".
    If you see anything different, describe what you see and someone will be able to give you instructions for repairing it.

  • How to attach simple Spring code as managed bean into amx:listView (list view in adf mobile application)

    I found very simple code to fetch facebook feed here:
    3.&amp;nbsp;Facebook API Binding
    it uses Spring Framework. I already added spring support into jDeveloper.
    code to fetch feed is something like this:
    String accessToken = "f8FX29g..."; // access token received from Facebook after OAuth authorization
    Facebook facebook = new FacebookTemplate(accessToken);
    List<Post> feed = facebook.feedOperations().getFeed();
    I created managed bean for my amx:listView - Facebook.java. And inserted this code. But of course it is not enough. I need somehow to add spring managed bean (not like mine).
    Can you help me with that?

    Thanks for your answer. But its too wasteful for my app to run additional server. My app is very simple so i do not need server side. May be there is another way, without Spring. I mean something simpler then raw JDK 1.4 - some ready-made tool for the needs of these?
    Thanks in advance

  • Can I set the value of a list binding in my managed bean?

    Dear All,
    This is just an exercise for me and I just wanted to experiment on the bindings of ADF for me to understand it further.
    I wanted to create a custom Model Driven LOV with my data control listed below
    Countries
         -CountryId
         -CountryName..but I wanted to display the label similar to this
    1 - USA
    2 - England
    n - France..so I thought of manipulating the select items in a bean
    <af:selectOneChoice id="soc1" value="#{bindings.Countries.inputValue}">
      <f:selectItems value="#{pageFlowScope.MyBean.countries}" id="si1" valuePassThru="true"/>
    </af:selectOneChoice>..and the code similar to this
    public class MyBean{
         public List<SelectItem> getCountries(){
              //countryMap points to accessing the iterator binding
              //BindingsHelper is a utility class that sets the value
              for(...){
                   SelectItem item = new SelectItem();
                   item.setLabel(countryMap.get("CountryId") + " - " + countryMap.get("CountryName"));
                   item.setValue(countryMap.get("CountryId"));
                   list.add(item);
              //set the item to the first row
              BindingsHelper.setExpressionValue("#{bindings.Countries.inputValue}",
                                     list.get(0).getValue());
              return list;
    }...on the last part I wanted to set the value to the first item but I am encountering numberformatexception when setting the list binding.
    I know I can do this declaratively also by removing the unselected item but as I have said I am experimenting on the bindings.
    Is this not possible?
    Thanks.
    JDev 11G PS5

    Hi ,
    I understand that , you want to show select one choice (dropdown) with label (countyid - country name) and value is (countryid).
    and these informnation is coming from ADf Model ( may be a VO).
    in the UI page you used this list is coming from MyBean
    <af:selectOneChoice id="soc1" value="#{bindings.Countries.inputValue}">
    <f:selectItems value="#{pageFlowScope.MyBean.countries}" id="si1" valuePassThru="true"/>
    </af:selectOneChoice>
    so ,
    The Managed Bean code should be ,
    private List<SelectItem> countries;
    ///setter method
    public void setCountries(List<SelectItem> countries) {
    this.countries= countries;
    // getter method
    public List<SelectItem> getQuoteStatusList() {
    quoteStatusList =
    selectItemsForIterator("countriesVOIterator",
    "countryId", "countryName");
    return quoteStatusList;
    public static List<SelectItem> selectItemsForIterator(String iteratorName, String valueAttrName, String displayAttrName) {
    return selectItemsForIterator(findIterator(iteratorName), valueAttrName, displayAttrName);
    public static DCIteratorBinding findIterator(String name) {
    DCIteratorBinding iter = getDCBindingContainer().findIteratorBinding(name);
    if (iter == null) {
    throw new RuntimeException("Iterator '" + name + "' not found");
    return iter;
    public static List<SelectItem> selectItemsForIterator(DCIteratorBinding iter, String valueAttrName, String displayAttrName) {
    List<SelectItem> selectItems = new ArrayList<SelectItem>();
    for (Row r : iter.getAllRowsInRange()) {
    string labelValue = (String)r.getAttribute(valueAttrName) +"-"+ (String)r.getAttribute(displayAttrName);
    selectItems.add(new SelectItem(r.getAttribute(valueAttrName),labelValue ));
    return selectItems;
    this will give you what you except in the ui
    when you try to get the value form that seclecOneChoice value in MyBean what user selects , you can simply get the value of this selectOneChoice.

  • Problems setting managed bean property of type Integer

    I got a problem when I use valueBinding #{param.productId} in faces-config.xml for my managed bean:
    My property 'productId' in bean Product is of type Integer, and my bean is in request scope. When I try to invoke some action on page, wich should navigate me to another view - JSF is trying to set productId for current view, and of course it is empty (""), and for the reasons given above I'm getting an error:
    javax.faces.FacesException: Can't set managed bean property: 'applicationId'.
    at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:576)
    at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:233)
    at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:256)
    ... 60 more
    Caused by: java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:489)
    at java.lang.Integer.<init>(Integer.java:609)
    at com.sun.faces.config.ManagedBeanFactory.getConvertedValueConsideringPrimitives(ManagedBeanFactory.java:855)
    at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:555)
    Should I use requestScope instead of param to have my parameter null, and not "" ?
    If so, how should I pass requestScope parameter using commandLink?

    Hi! I have a problem with setting params too. Probably my one is different.
    I have a jsp page which show a datatable, where I can see a row for each Product. If I click on its name I would navigate to another page that shows product informations, as several ecommerce sites do.
    But I can't understand what and how I must set to inform the details page on which product have to show.
    I read in this forum that it's possible to set a parameter in productBean, and then the constructor of product bean loads others fields knowing its id.
    The snippet of my faces-config.xml is:
      <managed-bean>
        <managed-bean-name>product</managed-bean-name>
        <managed-bean-class>test.backing.ProductBean</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
        <managed-property>
          <property-name>idToLoad</property-name>
          <property-class>java.lang.Integer</property-class>
          <value>#{param.id}</value>
        </managed-property>
      </managed-bean>It is possible? is a correct solution? and if it is, how can I do that?
    Thanks very much if someone can resolve my problem.
    Claudio.

  • Problems while defining EJB relations for container managed bean

    I am having a problem while trying to create my relations for my container managed bean.
    My Database schema is:
    Order table
    order_id
    message
    WorkItem table:
    order_id
    item_id
    message
    I have defined my OrderBean to have:
    @LocalMethod()
    @CmrField
    public abstract Collection getCmWorkItemsCmr();
    @LocalMethod()
    public abstract void setCmWorkItemsCmr(Collection workItems);
    I am not sure how to define my relation for my class:
    @Relation(cmrField = "cmWorkItemsCmr", multiplicity = Relation.Multiplicity.MANY, name = "Orders-CmWorkItems")
    An order can have many workitems. I am not sure how to fill in the rest for foreign Key jointable and such.
    Any help pointing me in the right direction would be helpful.
    Thanks,
    Ian

    I am having a problem while trying to create my relations for my container managed bean.
    My Database schema is:
    Order table
    order_id
    message
    WorkItem table:
    order_id
    item_id
    message
    I have defined my OrderBean to have:
    @LocalMethod()
    @CmrField
    public abstract Collection getCmWorkItemsCmr();
    @LocalMethod()
    public abstract void setCmWorkItemsCmr(Collection workItems);
    I am not sure how to define my relation for my class:
    @Relation(cmrField = "cmWorkItemsCmr", multiplicity = Relation.Multiplicity.MANY, name = "Orders-CmWorkItems")
    An order can have many workitems. I am not sure how to fill in the rest for foreign Key jointable and such.
    Any help pointing me in the right direction would be helpful.
    Thanks,
    Ian

  • Problems with managed beans on included JSPs

    I've got a problem with managed beans within an included JSP
    The included page looks as follows:
    <f:subview id="includedPage" binding="#{testBean.component}">
         <h:outputText value="Hallo from the included page"/>
         <h:outputText value="#{testBean.msg}" />
    </f:subview>The including page is also very simple
    <f:view>
         <html>
              <head>
                   <title>Test include</title>
              </head>
              <body>
                   <h:outputText value="Hello from the including page"/>               
                   <jsp:include page="included.jsp"/>
              </body>
         </html>
    </f:view>The testBean is a managed bean with page scope and looks as follows:
    public class TestBean {
        public UIComponent fComponent;
        public TestBean() {
            System.out.println("TestBean Constructor called " + toString() );
        public String getMsg() {
            return "Component = " + fComponent ;
        public void setComponent(UIComponent component) {
            System.out.println("setComponent called " + component);       
            fComponent = component;
        public UIComponent getComponent() {
            System.out.println("getComponent called " + fComponent);
            return fComponent;
    }The output to the console is:
    TestBean Constructor called de.kvb.athena.web.beans.TestBean@1bc16f0
    getComponent called null
    TestBean Constructor called de.kvb.athena.web.beans.TestBean@18622f3
    setComponent called javax.faces.component.UINamingContainer@160877b
    TestBean Constructor called de.kvb.athena.web.beans.TestBean@5eb489
    and the page displays
    Hello from the include page
    Hello from the included page Component = null
    Can anyone explain this behavior ? What's the reason that the page displays
    Component = null
    and is it possible to display the parent naming container (subview) this way ?
    how ?
    Thanks

    By "page scope" I assume you mean "none"? If so JSF creates a new bean for each place it's referenced. The closest to the behavior you want, once per "page", is really request scope.
    (I'm not sure why the constructor is being called thrice, though. I should look into this.)
    I assume you want a bean-per-subview scenario. This should be doable, and one way that allows a dynamic number of subviews would be as follows:
    --create a "manager" bean in request scope
    --give it get/set methods that retrieves a Map of "TestBean" instances; the idea is that each subview use a different key "s1", "s2", etc
    back the manager method with Map implementation that checks if there's already a TestBean associated with the key returns it if yes, else null.
    If that seems messy, the component solution is hairy :-) See http://forum.java.sun.com/thread.jspa?threadID=568937&messageID=2812561
    --A                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Sharepoint Designer 2010 and Visio 2013

    I am testing out Visio Professional 2013. I can import a VWI file from Sharepoint Designer 2010 and I can export a VWI file from Visio. But when I try to import the VWI file created in Visio 2013 into sharpoint Designer 2010 it appears to work, as I

  • Mountain Lion 10.8.2

    My Epson printer works but I can't scan even after downloading the 'fix'.  The same message still comes up which is "You can't open the application "EPSON Scan" because PowerPC applications are no longer supported. Any suggestions, anyone. Thanks.

  • All of my files in the cloud are gone!!!

    I was working on a project for a client just now and all of a sudden I get a notification from the Creative Cloud Connection that ALL of my files have been removed! I did nothing to trigger this. Now I cannot even see anything except my root folders

  • PS CC 2014 Exiting Text Edit mode when changing to another application

    I just updated to PS CC 2014 on my iMac running Mac OS X Yosemite. I noticed that if I enter Text Edit mode on a text layer and then change over (CMD+Tab or ALT+Tab) to the word processing app (TextEdit or Word) that Text Edit mode will commit. In PS

  • How to create textpool by using standard function module?

    hi, gurus. I have find two function modules ( RS_TEXTPOOL_READ / BX_AGR_READ_TEXTPOOL ) which is used to read but i want to write into the textpool is there any standard function module