JSF EL with nested properties

I have a problem to use EL to display nested properties.
suppose I have a beanA, and beanB; beanA contains beanB, and beanB has property propA.
if I want to display propA, I can use
<h:outputText value='#{beanA.beanB.propA}'/>
however if beanA has other beans, and I want to display those beans dynamically, I will take the "beanB.propA" part as a dynamic variable.
of course I can't use <h:outputText value='#{beanA.beanX.propX}'/>, as beanX.propX is not a static string. I tried <h:outputText value='#{beanA[beanX.propX]}'/> as well, it can't automatically get the second level from beanX.
anyone can help me?

I assume you know that the syntax "beanA.propX" is simply a shorthand for 'beanA["propX"]'? So if you know before hand what properties your beanA has, you can dynamically iterate over them like this:
<c:forEach items="#{'propX,propY,propZ'}" var="propName">
  <h:outputText value="#{beanA[propName]}" />
</c:forEach>If you don't know the type ahead of time or want to find the properties dynamically, you should probably write a function to return the collection of properties from a given key. A totally general solution is impossible (since the EL-Resolvers are pluggable, and don't always have a determinable set of keys), but the most common cases would be as follows:
* if the object is a key, return a set of integers 0 .. bean.size() - 1
* if the object is a map, return the key set (bean.keySet())
* otherwise use one of the 'java.beans.Introspector.getBeanInfo()' methods, and then the getPropertyDescriptors() method on the resulting BeanInfo to get the list of bean properties.

Similar Messages

  • Nested Properties in valueRef?

    Does anybody know if JSF supports nested properties for valueRef attribute?
    It would be something like:
    <h:input_text valueRef="userForm.user.name"/>
    <h:input_text valueRef="userForm.user.password"/>
    I tried it. Seems it doesn't work.

    Does anybody know if JSF supports nested properties
    for valueRef attribute?
    It would be something like:
    <h:input_text valueRef="userForm.user.name"/>
    <h:input_text valueRef="userForm.user.password"/>
    I tried it. Seems it doesn't work.JavaServer Faces supports the EL syntax of JSTL 1.0 and JSP 2.0, so the expressions you use above should work, if "userForm" identifies a bean in some scope (or a <managed-bean> entry in your faces-config.xml file), and this bean has a "getUser()" method that returns a bean with name and password properties.
    Craig

  • Announcing: Developing JSF Portlets with WebLogic Portal Whitepaper

    Just Released: Developing JSF Portlets with WebLogic Portal Whitepaper
    A supplemental developer's guide has been published to help guide WLP 10.x customers that wish to use JSF as the web framework for building portlets on WebLogic Portal. This is a sizable document (150 pages) that covers a large number of topics. It also coaches developers on best practices and common pitfalls.
    Important: It also clarifies the supported configuration of JSF within Portal Web Projects. Workshop for WebLogic by default configures a web project in a configuration that is not supported by WebLogic Portal. The guide explains how to address this:
    * Change from the unsupported MyFaces JSF implementation to the supported Sun Reference Implementation (RI)
    * Change from the unsupported "client" STATE_SAVING_METHOD to the supported "server"
    The guide can be downloaded here:
    http://download.oracle.com/technology/products/weblogic/portal/weblogic-portal-jsf-whitepaper.pdf
    To help internet searches locate this document, the table of contents is reproduced below:
    Introduction
    1.1. Prerequisites...................................................................... 8
    1.2. Applicable Versions............................................................ 8
    1.3. Native Portlet Bridges and Standard Portlet Bridges .......... 8
    1.4. JSF Portlet Support Roadmap ........................................... 9
    1.5. Whitepaper Structure ....................................................... 10
    1.6. Look Before You Leap ..................................................... 10
    1.7. For More Information........................................................ 10
    Part 1: Converting JSF Applications into Portlets
    2. IDE Support for JSF Portlets Chapter ...................................... 12
    2.1. Workshop for WebLogic – WebLogic Portal's Supported IDE 12
    2.2. Workshop Features for JSF Support in WebLogic Portal.. 12
    3. Introduction to JSF Portlets Chapter ........................................ 18
    3.1. Creating Your First JSF Portlet......................................... 18
    3.2. Essentials of JSF Portlet Views........................................ 21
    3.3. WebLogic Portal Artifacts................................................. 22
    4. Configuring JSF within WebLogic Portal Chapter..................... 24
    4.1. JSF Library Modules in WebLogic Server ........................ 24
    4.2. Installing the JSF Libraries into a Portal Web Project ....... 25
    4.3. JSF Configuration Settings............................................... 27
    4.4. Configuring JSF 1.2 ......................................................... 29
    4.5. Building an Unsupported JSF Implementation Library Module 31
    4.6. Faces Configuration is Web Application Scoped.............. 31
    5. Navigation within a JSF Portlet Chapter................................... 33
    5.1. Navigating within a Portlet with the JSF Controller ........... 33
    5.2. Redirects.......................................................................... 34
    6. Namespacing Chapter ............................................................. 35
    6.1. Namespacing Managed Bean Names.............................. 35
    6.2. Client ID Namespacing with the View and Subview Components 35
    6.3. Client ID Namespacing with the WLP NamingContainer .. 36
    7. Logging, Iterative Development, and Debugging Chapter ........ 39
    7.1. Logging............................................................................ 39
    7.2. Iterative Development ...................................................... 39
    7.3. Debugging ....................................................................... 40
    8. Custom JavaScript Chapter ..................................................... 42
    8.1. DOM Manipulation within a JSF ....................................... 42
    8.2. Form Validation within a JSF Portlet ................................ 45
    9. Preparing JSF Portlets for Production Chapter ........................ 46
    9.1. Configuration.................................................................... 46
    9.2. Performance and Scalability............................................. 47
    9.3. Security............................................................................ 49
    9.4. Localization...................................................................... 50
    Part 2: Interacting with the Portal Environment
    10. Native Bridge Architecture Chapter ...................................... 54
    10.1. Container Architecture Overview.................................. 54
    10.2. Container Architecture.................................................. 54
    10.3. Container Interactions .................................................. 55
    11. Interportlet Communication Chapter .................................... 56
    11.1. Using Session and Request Attributes for IPC (Anti-pattern) 56
    11.2. Using the WLP Event Facility for IPC with JSF Portlets 56
    11.3. Notifications ................................................................. 60
    11.4. Comparison of the IPC Approaches ............................. 60
    12. Scopes Chapter ................................................................... 62
    12.1. Conceptual Scopes for Standard JSF Applications ...... 62
    12.2. Conceptual Scopes for Portal Applications................... 63
    12.3. Implementation Patterns for Portal Scopes .................. 63
    13. State Sharing Patterns Chapter ........................................... 66
    13.1. State Sharing Concepts ............................................... 66
    13.2. HttpSession Versus HttpServletRequest ...................... 66
    13.3. Base Code for HttpSession Patterns ............................ 67
    13.4. Single Portlet Pattern ................................................... 68
    13.5. Multiple Portlet Patterns ............................................... 69
    14. Rendering Lifecycles Chapter .............................................. 77
    14.1. WLP and JSF Lifecycles .............................................. 77
    14.2. Invocation Order of WLP and JSF Lifecycle Methods... 77
    14.3. Accessing WLP Context Objects from JSF Managed Beans 78
    15. Portal Navigation Chapter .................................................... 80
    15.1. Programmatically Constructing JSF Portlet URLs ........ 80
    15.2. Changing the Active Portal Page.................................. 80
    15.3. Redirects within a Portal............................................... 83
    16. Ajax Enablement Chapter .................................................... 85
    16.1. Ajax in JSF Portlets...................................................... 85
    16.2. Partial Page Rendering Pattern.................................... 85
    16.3. Stateless API Request Pattern ..................................... 86
    16.4. Portlet Aware API Request Pattern .............................. 87
    16.5. Controlling the WLP Ajax Framework........................... 91
    17. Additional WLP Features Chapter........................................ 93
    17.2. Portlet Container Features ........................................... 93
    17.3. Portal Container Features ............................................ 98
    18. Example: Implementing a Login Portlet Chapter .................. 99
    18.1. Login Portlet Motivation................................................ 99
    18.2. Login Portlet Design..................................................... 99
    18.3. Login Portlet Implementation...................................... 101
    Part 3: Integrating Third Party Libraries
    19. Integration Overview Chapter............................................. 111
    19.1. Types of Libraries....................................................... 111
    19.2. Roadmap for MyFaces Trinidad and ADF Faces Rich Client 111
    20. Using the Facelets View Technology Chapter.................... 113
    20.1. Introduction to Facelets .............................................. 113
    20.2. Configuring Facelets Support ..................................... 113
    21. Using the Apache MyFaces Tomahawk Component Library Chapter 115
    21.1. What is Apache MyFaces Tomahawk? ...................... 115
    21.2. Support for Tomahawk in WLP................................... 115
    21.3. Tomahawk Component List........................................ 116
    21.4. Installing and Configuring Tomahawk......................... 119
    21.5. Resolving the Duplicate ID Issue................................ 120
    21.6. Referring to Resources .............................................. 120
    21.7. forceId Attribute.......................................................... 124
    21.8. File Upload................................................................. 125
    22. Using the Apache Beehive Navigation Controller Chapter . 126
    22.1. Apache Beehive Page Flow ....................................... 126
    22.2. JSF and Page Flows .................................................. 126
    22.3. Configuring the JSF Integration with Page Flows ....... 127
    Appendices
    23. Appendix 1: Consolidated List of Best Practices ................ 130
    24. Appendix 2: Known Issues and Workarounds.................... 132
    24.1. CR383659, CR383662 Inconsistent failures with JSF portlets 132
    24.2. CR342124: IllegalStateException due to duplicate client-id 132
    24.3. CR384916: IllegalStateException due to duplicate client-id when using certain components such as Tomahawk and Trinidad...... 133
    24.4. CR361477 Problems with the integration of JSF portlets with Apache Beehive Page Flows.................................................................. 133
    24.5. CR377945 JSF 1.2 suffers from a memory leak during iterative development .............................................................................. 134
    25. Appendix 3: The JSFPortletHelper Class ........................... 135
    26. Appendix 4: The CleanupPhaseListener Class .................. 147

    Hi Peter!
    First, I wish to thank you for the great work.
    We followed your whitepaper and managed to deploy a JSF portlet on WLS.
    But we are not able to register it (consume it) as remote portlet in Oracle Portal 10.1.4. The error log is as follows:
    An error occurred while trying to refresh the provider. (WWC-43190)
    An error occurred during the call to the WSRP Provider:
    java.rmi.RemoteException: serialization error: serialization error:
    unexpected null value for literal data; nested exception is:
    serialization error: serialization error: unexpected null value for literal data
    com.sun.xml.rpc.encoding.SerializationException: serialization error:
    serialization error: unexpected null value for literal data
    com.sun.xml.rpc.encoding.SerializationException: serialization error:
    unexpected null value for literal data
    Java stack trace from root exception:
    unexpected null value for literal data
    at
    oracle.webdb.wsrp.RegistrationContext_LiteralSerializer.doSerialize(RegistrationContext_LiteralSerializer.java:107)
    at
    com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.internalSerialize(LiteralObjectSerializerBase.java:119)
    at
    com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.serialize(LiteralObjectSerializerBase.java:70)
    at
    oracle.webdb.wsrp.GetServiceDescription_LiteralSerializer.doSerialize(GetServiceDescription_LiteralSerializer.java:88)
    at
    com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.internalSerialize(LiteralObjectSerializerBase.java:119)
    at
    com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.serialize(LiteralObjectSerializerBase.java:70)
    at
    com.sun.xml.rpc.client.StreamingSender._writeRequest(StreamingSender.java:473)
    at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:62)
    at
    oracle.webdb.wsrp.WSRP_v1_ServiceDescription_PortType_Stub.getServiceDescription(WSRP_v1_ServiceDescription_PortType_Stub.java:63)
    at
    oracle.webdb.wsrp.client.design.v1.OraWSRP_v1_ServiceDescription_PortType.getServiceDescription(Unknown
    Source)Do you have any idea why this happens? Or you can provide some useful links to WLP -Oracle Portal federation?
    Thank you and best regards,
    PaKo

  • Help with nesting tags (STRUTS)

    Hi,
    I'm having a few problems with the following nested tag:
    <input name="indicator_target_<bean:write name='indicators' property='indicator_id'/>" size="10" value="<bean:write name="TargetValuesActionForm" property="indicator_target_<bean:write name='indicators' property='indicator_id'/>"/>"/>
    The page returns no getter method for "indicator_target_", but i'm not trying to get the "indicator_target_" value i'm trying to get the "indicator_target_ + id" (i.e. indicator_target_23) value. For some reason the nested _<bean:write name='indicators' property='indicator_id'/> tag which is part of the input 'value' param is being ignored?
    anyone know how I can resolve this?

    One of the first rules of JSP custom tags - you cannot use a tag as an attribute to another tag. For dynamic attributes you have to use a runtime expression. - either <%= expr %> or in a JSP2.0 container ${expr} as well.
    Your "input" tag is plain template html. So you can use custom tags for the values of the attributes.
    The one that is failing is
    <bean:write name="TargetValuesActionForm" property="indicator_target_<bean:write name='indicators' property='indicator_id'/>"/>
    I am presuming you are in a logic:iterate loop, or equivalent.
    Something like this might work:
    <bean:define id="currentId"  name='indicators' property='indicator_id'/>
    <bean:write name="TargetValuesActionForm" property="<%= "indicator_target_" + currentId %>"/>However all of this is very nasty.
    And struts can do at least part of this for you with indexed properties. You might want to take a look at them.
    Hope this helps,
    evnafets

  • Importing SVG with nested clip-path

    I'm having serious issues in Illustrator CS5 trying to import SVG files with nested clip-path properties.
    Illutrator seems to create unnecessary groups, and messes up with group parents, effectively screwing things up.
    Here is a minimal example :
    <?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [<!ENTITY ns_svg "http://www.w3.org/2000/svg"><!ENTITY ns_xlink "http://www.w3.org/1999/xlink">]>
    <svg version="1.1" id="main" overflow="visible" xmlns="&ns_svg;" xmlns:xlink="http://www.w3.org/1999/xlink">
      <g id="piece-1">
        <g clip-path="url(#cpform)" id="form1">
          <g clip-path="url(#cplogo)" id="logo1">
                        <rect fill="#FF0000" x="10" y="10" width="1000" height="1000" />
          </g>
        </g>
      </g>
      <g transform="matrix(1,0,0,1,200,0)" id="piece-2">
        <g clip-path="url(#cpform)" id="form2">
          <g clip-path="url(#cplogo)" id="logo2">
                        <rect fill="#FF0000" x="10" y="10" width="1000" height="1000" />
          </g>
        </g>
      </g>
      <clipPath id="cpform">
              <rect x="0" y="0" width="150" height="150">
              </rect>
      </clipPath>
      <clipPath id="cplogo">
              <rect x="0" y="0" width="100" height="100">
              </rect>
      </clipPath>
    </svg>
    Such a valid SVG file displays fine in Chrome, IE, Opera, Firefox, but Illustrator fails loading it properly, because it creates two groups between "main" and "piece-1" (which is in itself not too bad), and sets piece-1 as a brother of another unnecesarry group from which piece-2 will descend. piece-2 and piece-1 are then clipped with piece-1 clip-path, which is just plain wrong and screws display.
    Note that you can move piece-2 to the root of the document, which restores the display. But save this fixed file, and open it again : it"s back to its broken state.
    Does anoyone know if this is fixed in CS6 ? If there is a workaround ?

    AI doesn't care for the original structure of an SVG. It will merely try to retain the appearance based on its own internal logic, which of course matches how you would create a normal AI file. So no, you can't probably avoid it.
    Mylenium

  • Returning from a JSF flow with faces-redirect

    I'm using Glassfish 4.1 with JSF 2.2.9. I can't figure out how to return from a JSF flow with a redirect. I've tried this in the flow definition xml:
    <flow-return id="returnFromFlow">
        <from-outcome>/index.xhtml?faces-redirect=true</from-outcome>
    </flow-return>
    This does the redirect but results in navigation errors on the page, specifically the button that enters the flow again: "Unable to find matching navigation case from view ID '/index.xhtml' for outcome 'select-person'" (the flow is called select-person).
    I've also tried appending faces-redirect=true to the action of the commandButton that exits the flow. Now the flow does not exit, it reloads the current page within the flow and says "Unable to find matching navigation case with from-view-id '/select-person/select-person.xhtml' for action 'returnFromFlow?faces-redirect=true' with outcome 'returnFromFlow?faces-redirect=true'"
    Exiting the flow with h:link works, but I want to be able to call an action and submit form values with the button so that isn't a good workaround for me.
    What's kind of interesting is that navigating between views within the flow DOES work with faces-redirect=true. I can add a "step2" node, and a commandButton with action="step2?faces-redirect=true", and it works. It's just exiting the flow that does not work.
    Any ideas?

    Hi Frank,
    Thanks so much for your response.
    Yes, since the user can do a commit prior to exiting my edit task flow, option 1 will not work for me.
    Option 2 sounded feasible, but jdeveloper would not let me set the restore point to true, since my btf didn't require a transaction. Is there a step I'm missing here??
    The thing that is really getting me when return via the cancel button from this edit task flow, back to my parent task flow, the record pointer is always moving back to the beginning of the data set in my parent task flow. For example,if I have a data set
    rec1, rec2, rec3..
    On my parent taskflow call it browser task flow, I navigate (via the next button) to rec3, and I click edit. At this point, my edit task flow kicks off, and since both task flows share the same data control, the edit task flow rec pointer is the same as the browse one.
    Okay I decide I don't want to change anything in my rec3, so I click cancel.
    At this point, when I return back to the navigator task flow, it points me back to rec1 ..
    HOwever, the savepoint seems to fix this. When I set my cancel return from edit taskflow to savePoint = true, the rec pointer stays in the correct spot. However, I cannot always do this, because the user can make iterative saves in the edit task flow which (based on your previous email) stales out the savepoint id.
    Question, so in this case, how can I make the parent browser task flow call stay on the same record I was just editing, opposed to going back to the beginning of the data set(ie. rec1)??

  • Issues with nested for loops - saving images from a camera

    Hi all,
    I've written a vi. to capture a specific number of images ('Image No') and save these images, outputted to a folder of my choice.  Each image is identified sequentially.  However, I wish to do a number of iterations ('Run') of this capture sequence, such that the filename of each image would be 'Filename (Run)_(Image No).png', e.g. run 5, image 10 would be 'Filename 5_10.png'.  I have tried a nested for loop for this but I receive an error 'Asynchronous I/O operation in progress' (I've attached a printscreen).
    Can anyone assist me in solving this problem? I preiously posted this in machine Vision but got no response (http://forums.ni.com/t5/Machine-Vision/Capturing-image-sequences-issues-with-nested-for-loops/m-p/19...).  Please find attached my vi.
    Kindest regards and thanks,
    Miika
    Solved!
    Go to Solution.
    Attachments:
    Labview problem.jpg ‏3841 KB
    Image sequence save to file.vi ‏48 KB

    Miika,
    the problem is not the filenam, but the name of the folder (AHHHHH!). You try to create the same folder in the outer for loop over and over again.... (it is the error message above the '======', not below )
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How to set the screen size with nested Iview screen

    Can someone show me how to set the screen size with nested IView  screen.
    at the moment i only try it with trial and error untill it looks somewhat close. Is there a property in VC to set the size for Height and width.
    The same question is for the form. the form elements inside the form is easy but the actual form is still a challenge.

    Hi,
    Yes you are correct ,Still the Form and iview are not able to change thier Layout Structure using a Propery.
    it is available with VC7.1
    Govindu

  • Custom taglib with nested tag not working

    Hi everybody,
    I have a question concerning a custom taglib. I want to create a tag with nested child tags. The parent tag is some kind of iterator, the child elements shall do something with each iterated object. The parent tag extends BodyTagSupport, i have overriden the methods doInitBody and doAfterBody. doInitBody initializes the iterator and puts the first object in the pageContext to be used by the child tag. doAfterBody gets the next iterator object and puts that in the pageContext, if possible. It returns with BodyTag.EVAL_BODY_AGAIN when another object is available, otherwise BodyTag.SKIP_BODY.
    The child tag extends SimpleTagSupport and does something with the given object, if it's there.
    In the tld-file I have configured both tags with name, class and body-content (tagdependent for the parent, empty for the child).
    The parent tag is being executed as I expected. But unfortunately the nested child tag does not get executed. If I define that one outside of its parent, it works fine (without object, of course).
    Can somebody tell me what I might have missed? Do I have to do something special with a nested tag inside a custom tag?
    Any help is greatly appreciated!
    Thanks a lot in advance!
    Greetings,
    Peter

    Hi again,
    unfortunately this didn't work.
    I prepared a simple example to show what isn't working. Perhaps it's easier then to show what my problem is:
    I have the following two tag classes:
    public class TestIterator extends BodyTagSupport {
        private Iterator testIteratorChild;
        @Override
        public void doInitBody() throws JspException {
            super.doInitBody();
            System.out.println("TestIterator: doInitBody");
            List list = Arrays.asList(new String[] { "one", "two", "three" });
            testIteratorChild = list.iterator();
        @Override
        public int doAfterBody() throws JspException {
            int result = BodyTag.SKIP_BODY;
            System.out.println("TestIterator: doAfterBody");
            if (testIteratorChild.hasNext()) {
                pageContext.setAttribute("child", testIteratorChild.next());
                result = BodyTag.EVAL_BODY_AGAIN;
            return result;
    public class TestIteratorChild extends SimpleTagSupport {
        @Override
        public void doTag() throws JspException, IOException {
            super.doTag();
            System.out.println(getJspContext().getAttribute("child"));
            System.out.println("TestIteratorChild: doTag");
    }The Iterator is the parent tag, the Child shall be shown in each iteration. My taglib.tld looks like the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <taglib
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee web-jsptaglibrary_2_1.xsd"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1">
         <tlib-version>1.0</tlib-version>
         <short-name>cms-taglib</short-name>
         <uri>http://www.pgoetz.de/taglibs/cms</uri>
         <tag>
              <name>test-iterator</name>
              <tag-class>de.pgoetz.cms.taglib.TestIterator</tag-class>
              <body-content>tagdependent</body-content>
         </tag>
         <tag>
              <name>test-iterator-child</name>
              <tag-class>de.pgoetz.cms.taglib.TestIteratorChild</tag-class>
              <body-content>empty</body-content>
         </tag>
    </taglib>And the snippet of my jsp is as follows:
         <!-- TestIterator -->
         <cms:test-iterator>
              <cms:test-iterator-child />
         </cms:test-iterator>The result is that on my console I get the following output:
    09:28:01,656 INFO [STDOUT] TestIterator: doInitBody
    09:28:01,656 INFO [STDOUT] TestIterator: doAfterBody
    09:28:01,656 INFO [STDOUT] TestIterator: doAfterBody
    09:28:01,656 INFO [STDOUT] TestIterator: doAfterBody
    09:28:01,656 INFO [STDOUT] TestIterator: doAfterBody
    So the child is never executed.
    It would be a great help if anybody could tell me what's going wrong here.
    Thanks and greetings from germany!
    Peter
    Message was edited by:
    Peter_Goetz

  • JSF combined with EJB, how??

    Hi @ll,
    I have been trying for some days to combine my JSF pages with EJB Session Beans, but I haven't really found a working way to do it.
    First, I had my session bean directly as the backing bean for the JSF page, but I read somewhere that this isn't "allowed", so I created a helper bean as managed bean. This is now the backing bean for the jsf page and has as attribute the session bean.
    My helper bean:
    public class ManagedHelperBean {
    @EJB private JDDACReaderBeanRemote reader;
    public JDDACReaderBeanRemote getReader() {
         return reader;
    public void setReader(JDDACReaderBeanRemote reader) {
         this.reader = reader;
    }Part of my faces-config.xml
    <managed-bean>
    <managed-bean-name>helper</managed-bean-name>
    <managed-bean-class>com.company.ManagedHelperBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>Part of my jsp page:
    <h:outputText value="#{helper}"/>
    <h:outputText value="#{helper.reader}"/>Now, the first output in the jsp page works, the second one doesn't. Why can't the property reader be accessed?? What is the correct way to combine JSF with EJB?
    Kind regards,
    Wiebke

    Hello,
    I faced the same problem, but on a Weblogic 10 server.
    The problem with Weblogic 10 is, even if it's "supposed" to be a EE5 compliant server, it is not.
    As described here http://e-docs.bea.com/wls/docs100/webapp/annotateservlet.html , there is no Dependency Injection in JSF managed beans:
    The web container will not process annotations on classes like Java Beans and other helper classes.
    But, WL 10 offers DI on Servlets, Filters and Listeners.
    Here is how I solved it (probably not the best way, but it works for me):
    - created a filter with a list of EJB injected (as it works). For every filtered request, set a list of known (enum) as request attributes mapped each to a EJB service:
    public class EJBInjectFilter implements Filter {
    @EJB
    private MyEJBService ejbRef;
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException,
                   ServletException {
    log.debug("Setting EJB ref into request as attribute ");
              req.setAttribute(ServiceEnum.MY_EJB_SERVICE.toString(), ejbRef);
              chain.doFilter(req, resp);     
    - for every managed bean who needs a service you can do something like:
    (MyEJBService) ((HttpServletRequest) FacesContext.getCurrentInstance().
                   getExternalContext().getRequest()).getAttribute(ServiceEnum.MY_EJB_SERVICE.toString())
    to get a reference to service.
    I agree it is a totally not elegant solution. But why does WL 10 say it's a full JEE5 compliant server, and though does not provide DI for managed beans?
    A drawbacks I could think of is performance slow-down (for every request, apply filter, set list of attributes + references into request) - probably it does take some time.
    Let me know your thoughts.
    Edited by: cosminj on Nov 20, 2007 8:16 AM

  • UnmarshalException with nested EOFException on Naming.lookup()

    I have an RMI server object that creates its own RMI registry and binds, like this:
         Registry registry = LocateRegistry.createRegistry(1099);
         registry.bind("JournalReceiver", this);I run this from the command line to get it started. Everything looks good.
    My client is running as a webapp in Tomcat (on the same machine), and it executes this call:
            receiver = (RmiJournalReceiverInterface) Naming.lookup("JournalReceiver");and gets this error
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
         java.io.EOFException
         at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
         at java.rmi.Naming.lookup(Naming.java:84)It is clear that I'm reaching the registry, and if I modify the code to intentionally lookup the wrong name I get a "not bound error", so I'm pretty confident that my server object is indeed bound to that name. Beyond that, I'm lost.
    Any thoughts?
    jb

    OK - the problem was an incorrect codebase.
    My server object creates its own registry with
           Registry registry = LocateRegistry.createRegistry(1099);
         registry.bind("JournalReceiver", this);and I get the UnmarshalException with nested EOFException, as shown above.
    However, if I set up an outside registry with 'rmiregistry', and use
            Naming.rebind("JournalReceiver", this)then I get the UnmarshalException with nested ClassNotFoundException, which has shown up in several threads.
    So, following the advice given in those threads, I fix the codebase like this:
    java -Djava.rmi.server.codebase=file:/var/local/jb/RmiReceiver.jar \
       org.nsdl.RmiJournalReceiverand it works as advertised, even when I go back to my original lines of binding code.
    Thanks again for the help.
    jb

  • Import tables with nested table : ORA-00600

    In Oracle 9.2
    Create object, type as table, and table with nested table (store as syms_ntab) are successfully.
    Also its export.
    In process of import on another server (also 9.2, 'fromuser=one touser=two') shows errors:
    . . importing table "SYMS_NTAB"
    IMP-00058: ORACLE error 600 encountered
    ORA-00600: internal error code, arguments: [kokeeafi1], [2], [2], [], [], [], [], []
    IMP-00075: Warning: The nested table may contain partial rows or duplicate rows
    But for all that table is created and error occur on phase inserting strings.
    What is this?
    In Oracle 8.0.5 i perform similar operation without error.

    From Oracle error messages and codes manual:
    ORA-00600 internal error code, arguments: [string], [string], [string], [string], [string], [string], [string], [string]
    Cause: This is the generic internal error number for Oracle program exceptions. It indicates that a process has encountered a low-level, unexpected condition. Causes of this message include:
    * timeouts
    * file corruption
    * failed data checks in memory
    * hardware, memory, or I/O errors
    * incorrectly restored files
    The first argument is the internal message number. Other arguments are various numbers, names, and character strings. The numbers may change meanings between different versions of Oracle.
    Action: Report this error to Oracle Support Services after gathering the following information:
    * events that led up to the error
    * the operations that were attempted that led to the error
    * the conditions of the operating system and databases at the time of the error
    * any unusual circumstances that occurred before receiving the ORA-00600 message
    * contents of any trace files generated by the error
    * the relevant portions of the Alter files
    Note: The cause of this message may manifest itself as different errors at different times. Be aware of the history of errors that occurred before this internal error.

  • Query rewrites with Nested materialized views with different aggregations

    Platform used : Oracle 11g.
    Here is a simple fact table (with measures m1,m2) and dimensions (a) Location (b) Calendar and (c) Product. The business problem is that aggregation operator for measure m1,m2 are different along location dimension and Calendar dimension. The intention is to preaggregate the measures for a product along the calendar dimension and Location dimension and store it as materialized views.
    The direct option is to define a materialized view with Inline queries (Because of the different aggrergation operator, it is not possible to write a query without Inline query). http://download-uk.oracle.com/docs/cd/B28359_01/server.111/b28313/qradv.htm#BABEAJBF documents the limitations that it works only for 'Text match' and 'Equivalent queries' and that is too limiting.
    So decided to have nested materialized view, with first view having just joins(my_dim_mvw_joins), the second view having aggregations along Calendar dimension (my_dim_mvw_calendar) and third view having aggregations along the Location dimension(my_dim_mvw_location). Obviously I do not want the query I fire to know about materialized views and I fire it against the fact table. I see that for the fired query (Which needs aggregations along both Calendar and Location), is rewritten with just second materialized view but not the third. (Had set QUERY_REWRITE_INTEGRITY as TRUSTED) .
    Wanted to know whether there are limitations on Query Writes with nested materialized views? Thanks
    (Have given a simple testable example below. Pls ignore the values given in 'CALENDAR_IDs', 'PRODUCT_IDs' etc as they are the same for all the queries)
    -- Calendar hierarchy table
    CREATE TABLE CALENDAR_HIERARCHY_TREE
    (     "CALENDAR_ID" NUMBER(5,0) NOT NULL ENABLE,
    "HIERARCHY1_ID" NUMBER(5,0),
    "HIERARCHY2_ID" NUMBER(5,0),
    "HIERARCHY3_ID" NUMBER(5,0),
    "HIERARCHY4_ID" NUMBER(5,0),
    CONSTRAINT "CALENDAR_HIERARCHY_TREE_PK" PRIMARY KEY ("CALENDAR_ID")
    -- Location hierarchy table
    CREATE TABLE LOCATION_HIERARCHY_TREE
    (     "LOCATION_ID" NUMBER(3,0) NOT NULL ENABLE,
    "HIERARCHY1_ID" NUMBER(3,0),
    "HIERARCHY2_ID" NUMBER(3,0),
    "HIERARCHY3_ID" NUMBER(3,0),
    "HIERARCHY4_ID" NUMBER(3,0),
    CONSTRAINT "LOCATION_HIERARCHY_TREE_PK" PRIMARY KEY ("LOCATION_ID")
    -- Product hierarchy table
    CREATE TABLE PRODUCT_HIERARCHY_TREE
    (     "PRODUCT_ID" NUMBER(3,0) NOT NULL ENABLE,
         "HIERARCHY1_ID" NUMBER(3,0),
         "HIERARCHY2_ID" NUMBER(3,0),
         "HIERARCHY3_ID" NUMBER(3,0),
         "HIERARCHY4_ID" NUMBER(3,0),
         "HIERARCHY5_ID" NUMBER(3,0),
         "HIERARCHY6_ID" NUMBER(3,0),
         CONSTRAINT "PRODUCT_HIERARCHY_TREE_PK" PRIMARY KEY ("PRODUCT_ID")
    -- Fact table
    CREATE TABLE RETAILER_SALES_TBL
    (     "PRODUCT_ID" NUMBER,
    "PRODUCT_KEY" VARCHAR2(50 BYTE),
    "PLAN_ID" NUMBER,
    "PLAN_PERIOD_ID" NUMBER,
    "PERIOD_ID" NUMBER(5,0),
    "M1" NUMBER,
    "M2" NUMBER,
    "M3" NUMBER,
    "M4" NUMBER,
    "M5" NUMBER,
    "M6" NUMBER,
    "M7" NUMBER,
    "M8" NUMBER,
    "LOCATION_ID" NUMBER(3,0),
    "M9" NUMBER,
    CONSTRAINT "RETAILER_SALES_TBL_LOCATI_FK1" FOREIGN KEY ("LOCATION_ID")
    REFERENCES LOCATION_HIERARCHY_TREE ("LOCATION_ID") ENABLE,
    CONSTRAINT "RETAILER_SALES_TBL_PRODUC_FK1" FOREIGN KEY ("PRODUCT_ID")
    REFERENCES PRODUCT_HIERARCHY_TREE ("PRODUCT_ID") ENABLE,
    CONSTRAINT "RETAILER_SALES_TBL_CALEND_FK1" FOREIGN KEY ("PERIOD_ID")
    REFERENCES CALENDAR_HIERARCHY_TREE ("CALENDAR_ID") ENABLE
    -- Location dimension definition to promote query rewrite
    create DIMENSION LOCATION_DIM
    LEVEL CHAIN IS LOCATION_HIERARCHY_TREE.HIERARCHY1_ID
    LEVEL CONSUMER_SEGMENT IS LOCATION_HIERARCHY_TREE.HIERARCHY3_ID
    LEVEL STORE IS LOCATION_HIERARCHY_TREE.LOCATION_ID
    LEVEL TRADING_AREA IS LOCATION_HIERARCHY_TREE.HIERARCHY2_ID
    HIERARCHY PROD_ROLLUP (
    STORE CHILD OF
    CONSUMER_SEGMENT CHILD OF
    TRADING_AREA CHILD OF
    CHAIN
    -- Calendar dimension definition
    create DIMENSION CALENDAR_DIM
    LEVEL MONTH IS CALENDAR_HIERARCHY_TREE.HIERARCHY3_ID
    LEVEL QUARTER IS CALENDAR_HIERARCHY_TREE.HIERARCHY2_ID
    LEVEL WEEK IS CALENDAR_HIERARCHY_TREE.CALENDAR_ID
    LEVEL YEAR IS CALENDAR_HIERARCHY_TREE.HIERARCHY1_ID
    HIERARCHY CALENDAR_ROLLUP (
    WEEK CHILD OF
    MONTH CHILD OF
    QUARTER CHILD OF
    YEAR
    -- Materialized view with just joins needed for other views
    CREATE MATERIALIZED VIEW my_dim_mvw_joins build immediate refresh complete enable query rewrite as
    select product_id, lht.HIERARCHY1_ID, lht.HIERARCHY2_ID, lht.HIERARCHY3_ID, lht.location_id, cht.HIERARCHY1_ID year,
    cht.HIERARCHY2_ID quarter, cht.HIERARCHY3_ID month, cht.calendar_id week, m1, m3, m7, m9
    from retailer_sales_tbl RS, calendar_hierarchy_tree cht, location_hierarchy_tree lht
    WHERE RS.period_id = cht.CALENDAR_ID
    and RS.location_id = lht.location_id
    and cht.CALENDAR_ID in (10,236,237,238,239,608,609,610,611,612,613,614,615,616,617,618,619,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477)
    AND product_id IN (5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20)
    AND lht.location_id IN (2, 3, 11, 12, 13, 14, 15, 4, 16, 17, 18, 19, 20)
    -- Materialized view which aggregate along calendar dimension
    CREATE MATERIALIZED VIEW my_dim_mvw_calendar build immediate refresh complete enable query rewrite as
    select product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID ,location_id, year, quarter, month, week,
    sum(m1) m1_total, sum(m3) m3_total, sum(m7) m7_total, sum(m9) m9_total,
    GROUPING_ID(product_id, location_id, year, quarter, month, week) dim_mvw_gid
    from my_dim_mvw_joins
    GROUP BY product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID , location_id,
    rollup (year, quarter, month, week);
    -- Materialized view which aggregate along Location dimension
    CREATE MATERIALIZED VIEW my_dim_mvw_location build immediate refresh complete enable query rewrite as
    select product_id, year, quarter, month, week, HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id,
    sum(m1_total) m1_total_1, sum(m3_total) m3_total_1, sum(m7_total) m7_total_1, sum(m9_total) m9_total_1,
    GROUPING_ID(product_id, HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id, year, quarter, month, week) dim_mvw_gid
    from my_dim_mvw_calendar
    GROUP BY product_id, year, quarter, month, week,
    rollup (HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id)
    -- SQL Query Fired (for simplicity have used SUM as aggregation operator for both, but they will be different)
    select product_id, year, HIERARCHY1_ID, HIERARCHY2_ID,
    sum(m1_total) m1_total_1, sum(m3_total) m3_total_1, sum(m7_total) m7_total_1, sum(m9_total) m9_total_1
    from
    select product_id, HIERARCHY1_ID , HIERARCHY2_ID , year,
    sum(m1) m1_total, sum(m3) m3_total, sum(m7) m7_total, sum(m9) m9_total
    from
    select product_id, lht.HIERARCHY1_ID , lht.HIERARCHY2_ID , lht.HIERARCHY3_ID ,lht.location_id, cht.HIERARCHY1_ID year, cht.HIERARCHY2_ID quarter, cht.HIERARCHY3_ID month, cht.calendar_id week,m1,m3,m7,m9
    from
    retailer_sales_tbl RS, calendar_hierarchy_tree cht, location_hierarchy_tree lht
    WHERE RS.period_id = cht.CALENDAR_ID
    and RS.location_id = lht.location_id
    and cht.CALENDAR_ID in (10,236,237,238,239,608,609,610,611,612,613,614,615,616,617,618,619,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477)
    AND product_id IN (5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20)
    AND lht.location_id IN (2, 3, 11, 12, 13, 14, 15, 4, 16, 17, 18, 19, 20)
    GROUP BY product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID , location_id, year
    ) sales_time
    GROUP BY product_id, year,HIERARCHY1_ID, HIERARCHY2_ID
    This Query rewrites only with my_dim_mvw_calendar. (as saw in Query Plan and EXPLAIN_MVIEW). But we would like it to use my_dim_mvw_location as that has aggregations for both dimensions.

    blackhole001 wrote:
    Hi all,
    I'm trying to make my programmer's life easier by creating a database view for them to query the data, so they don't have to worry about joining tables. This sounds like a pretty horrible idea. I say this because you will eventually end up with programmers that know nothing about your data model and how to properly interact with it.
    Additionally, what you will get is a developer that takes one of your views and see's that of the 20 columns in it, it has 4 that he needs. If all those 4 columns comes from a simple 2 table join, but the view has 8 tables, you're wasting a tonne of resources by using the view (and heaven forbid they have to join that view to another view to get 4 of the 20 columns from that other view as well).
    Ideally you'd write stored routines that satisfy exactly what is required (if you are the database resource and these other programmers are java, .net, etc... based) and the front end developers would call those routines customized for an exact purpose.
    Creating views is not bad, but it's by no means a proper solution to having developers not learn or understand SQL and/or the data model.

  • PL/SQL add procedure with nested table - Duplicate Thread

    Hi,
    I am trying to do a procedure to input information for one order and another for 2 orders.
    The information I have so far is as follows:
    Drop table Orders cascade constraints;
    Drop type item_type;
    Drop type Item_nested;
    Create or Replace Type item_type AS Object (
    Cat_code Varchar2(6),
    Amount_ord Number(3),
    Cost Number(5,2) );
    Create or Replace Type item_nested as table of item_type;
    Create Table Orders (
    Order_no Varchar2(8) constraint pkorder primary key,
    Customer_name Varchar2(30),
    AddressLine1 Varchar2(20),
    AddressLine2 Varchar2(20),
    AddressLine3 Varchar2(20),
    Town Varchar2(20),
    Postcode Varchar2(10),
    Country Varchar2(20),
    Order_items item_nested,
    Order_date Date)
    Nested Table Order_items
    Store as nested_items return as locator;
    This has so far worked but I have not managed the insert procedure.
    I am using Oracle SQL*plus
    Thanks
    SG
    Edited by: user10689875 on 11-Jan-2009 03:39

    Duplicate thread ->
    PL/SQL add procedure with nested table
    Please remove it & marked it as duplicate.
    Regards.
    Satyaki De.

  • Partition exchange error on table with nested table

    On Oracle 11.2.0.1, I have a partitioned table with some partitions that need to be 'archived' (in terms of moving partitions to an 'archive' table).
    I have a source table like:
    CREATE TABLE IS_PODACI245
      ID_OBJEKTA_IDENTIFIKACIJA  NUMBER(10),
      ID_OBJEKTA                 NUMBER(20),
      DATUM                      TIMESTAMP(6)       NOT NULL,
      TZ                         NUMBER(3),
      DATA1                      NUMBER(10),
      DATA2                      NUMBER(6),
      DATA3                      NUMBER(10),
      DATA4                      NUMBER,
      DATA5                      T_NTCIP_CLIMATE_TABLE
    NESTED TABLE DATA5 STORE AS IS_PODACI245_STORE_TABLE
    TABLESPACE DATA
    PARTITION BY RANGE (DATUM)
      PARTITION P_201107 VALUES LESS THAN (TIMESTAMP' 2011-08-01 00:00:00')
        LOGGING
        NOCOMPRESS
        TABLESPACE DATA, 
      PARTITION P_MAXVALUE VALUES LESS THAN (MAXVALUE)
        LOGGING
        NOCOMPRESS
        TABLESPACE DATA
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    CREATE INDEX IDX_IS_PODACI245_KOMPLEKS ON IS_PODACI245
    (ID_OBJEKTA_IDENTIFIKACIJA, ID_OBJEKTA, DATUM)
      TABLESPACE DATA
    LOCAL ( 
      PARTITION P_201107
        LOGGING
        NOCOMPRESS
        TABLESPACE DATA, 
      PARTITION P_MAXVALUE
        LOGGING
        NOCOMPRESS
        TABLESPACE DATA
    NOPARALLEL;
    CREATE OR REPLACE TYPE t_ntcip_climate_table as table of t_ntcip_climate_fmt;
    CREATE OR REPLACE TYPE t_ntcip_climate_FMT as object
    (  dev_index number(6)
    ,   dev_description varchar2(512)
    ,   dev_type number(10)
    ,   dev_status number(10)
    ,   dev_mfr_status varchar2(512)
    ,   dev_active number(3)
    ,   dev_test_activation number(10)
    /I would like to make exchange partition using stage table, and everything is going fine on all tables, but only on a few of them (listed source is one of them, and they're only tables with nested tables wihin), where I get an error.. but sometimes ;)
    on a statement like:
    ALTER TABLE IS_PODACI245_ARH EXCHANGE PARTITION P_201106  WITH TABLE IS_PODACI245_STAGE EXCLUDING INDEXES  WITHOUT VALIDATION;I got an error:
    ORA-00001: unique constraint (TXV.SYS_C0032911) violated
    it's an unique index between parent and nested table.
    what could cause that problem?

    Dear,
    I suppose that the unique constraint
    ORA-00001: unique constraint (TXV.SYS_C0032911) violatedis the one you 've created on the nested table IS_PODACI245_STORE_TABLE
    If so, why not disable that constraint and try again.
    I have never exchanged such a kind of partitioned table having a nested table in it. But, I could imagine that the cloned non partitioned table IS_PODACI245_STAGE should at least be the exact image of the partitioned table IS_PODACI245_ARH (of course without the partition part) but with the nested table part and including all indexes
    In addition, if you have a parent/child relationship between your partitioned tables, then there is a chronological order of exchange starting by the child and then finishing by the parent
    see the following link for more information about this order of exchange (and comment 2 for an example also)
    http://jonathanlewis.wordpress.com/2006/12/10/drop-parent-partition/#more-65
    Hope this helps
    Mohamed Houri

Maybe you are looking for