Access Metadata Property from java iview

Hi All
i'm developing a search engine that will take into consideration some property metadata within the search.
i have some dropdownlists in my search page and i want them to get the values from a property metadata in my KM.
i will appreciate your help here.
thanks in advance
Mr. B

Hi Jessica,
Here's an example of getting the modified property of a document:
IPortalComponentRequest request = (IPortalComponentRequest)this.getRequest();
IUser aUser = (IUser) request.getUser().getUser();
ResourceContext rContext = new ResourceContext(aUser);
RID aRid = new RID("/documemts/Public documents/example.txt");
IResourceFactory aResourceFactory = ResourceFactory.getInstance();
IResource r = aResourceFactory.getResource(aRid,rContext); 
IPropertyName modifiedName = new PropertyName("http://sapportals.com/xmlns/cm","modified");
IProperty modifiedProperty = r.getProperty(modifiedName);
Date modified = modifiedProperty.getDateValue();
For more information you can check the javadoc documentation of the classes in this example.
Hope that helps,
Yoav.

Similar Messages

  • Set the values of metadata properties from java

    Hi everybody,
    I created a metadata property "Category" in System Admin - System Config - KM - Global Services - Property Metadata.
    My requirements:
    When a user creates a document (upload or new txt file, etc.) in folder X the value of this metadata propery should also automatically be set to value X. So that the user doesn't need to set this value himself.
    This way we can have more reliability on the accuracy of the metadata of this field.
    Can anybody help me on how to set this property automatically in the screen for the creation of upload of a new file?
    Thanks
    Kind regards
    Wouter

    Hi Robert,
    It's been a while but I'm back
    We finally decided which way to go for this development (as it was on hold untill now) and we decided to go with the KM Repository service.
    I already started implementing this service and So far it reacts on the creation of new documents (CREATE_CHILD event).
    public void received(IEvent event)
       try{
           if(event instanceof IResourceEvent)
              IResourceEvent resevent = (IResourceEvent)event;
              switch(resevent.getType())
                 case ResourceEvent.CREATE_CHILD:
                         IResource res = resevent.getResource();
                         break;
    The resource (res) I get from the resourceEvent (resevent) is the parrent resource of the newly created resource. What I need is the newly created resoruce itself.
    Do you happen to know if there is an interface or method somewhere through which I can get access to this new resource?
    Otherwise the only way to do this would be to loop over the children of the parent folder and get the newest one. But this would just kill the performance as the folders keep on growing...

  • XMLAnalysis Error while trying to execute a MDX query on MS SSAS - Accessing the cube from Java through Olap4j driver

     Am trying to access MS SSAS data cube from Java through olap4j driver(through msmdpump.dll). I am able to connect , but when I try to execute a query, i am getting the below error: Please help
    me out . (I tested the http://XXXX/OLAP/msmdpump.dll in MS Excel , and it is working fine)
    org.olap4j.OlapException: XMLA provider gave exception: <soap:Fault xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <faultcode>
    XMLAnalysisError.0xc10a0004
    </faultcode>
    <faultstring>
    The CRASHDWHSRG cube either does not exist or has not been processed.
    </faultstring>
    <detail>
    <Error Description="The CRASHDWHSRG cube either does not exist or has not been processed." ErrorCode="3238658052" HelpFile="" Source="Microsoft SQL Server 2012 Analysis Services">
    </Error>
    </detail>
    </soap:Fault>

    See my other answer where you asked this same question on another thread
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/22dfc400-668d-4bd4-b76d-7c6b9ddda47a/msmdpumpdll-not-getting-registered?forum=sqlanalysisservices
    http://darren.gosbell.com - please mark correct answers

  • "access denied" error from Java Web Start

    I can successfully download the jar file, but always have error message "access denied" when the java application tries to open a local file in C:\temp\poc1.xml.
    I can successfully execute the java application from DOS,but failed when using Java Web Start. The error message is as follows:
    Java Web Start Console, started Wed Nov 28 16:30:31 PST 2001Java 2 Runtime Environment: Version
    1.3.1 by Sun Microsystems Inc.java.security.AccessControlException: access denied
    (java.io.FilePermission C:\temp\poc1.xml read)     at
    org.apache.xerces.framework.XMLParser.parse(Unknown Source)     at
    org.apache.xerces.framework.XMLParser.parse(Unknown Source)     at
    com.hotlocker.client.HLSessionParser.parse(Unknown Source)     at
    com.hotlocker.client.UploadDownloadClient.uploadFiles(Unknown Source)     at
    com.hotlocker.client.UploadDownload.main(Unknown Source)     at
    java.lang.reflect.Method.invoke(Native Method)     at
    com.sun.javaws.Launcher.executeApplication(Unknown Source)     at
    com.sun.javaws.Launcher.executeMainClass(Unknown Source)     at
    com.sun.javaws.Launcher.continueLaunch(Unknown Source)     at
    com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)     at
    com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)     at
    com.sun.javaws.Launcher.run(Unknown Source)     at java.lang.Thread.run(Unknown Source)

    Hi,
    you can't get a file like in a "normal" app
    because a JWS-app runs in the restricted
    sandbox environment by default.
    So you either sign your app with a digital certificate
    or you use a special FileOpenService (JNLP-API).
    You could also put the file into the app-jar and
    load it by a classloader.
    Regards,
    Mathias

  • Access SAP Tables from Java Program

    Hi All,
    We have a requirement to integrate attendance portal(which is done in java) with SAP.
    Our problem is how to access SAP tables from a Java program?
    Database is Sybase.
    Please suggest us a good solution.
    Thanks in advance...

    Did you go through Sap Help?
    Calling BAPIs from Java - BAPI User Guide CA-BFA) - SAP Library
    Regards,
    Philip.

  • Call transaction from java iView (link)

    Hi,
    I would like to call SAP R/3 transaction from a java iView. I know how to do it using the UrlGenerator service. Is there any other way of doing that ? (better way)
      Thanks, Nir.

    You can Use EPCM.doNavigate() to call R3 Transaction or something like this:
    <hbj:link id="r3"
              text="R3 Transaction">
    <% r3.setOnClientClick("OpenWindow('/irj/servlet/prt/portal/prtroot/com.sap.portal.appintegrator.sap.Transaction?System=SAP_R3&TCode=SE80&GuiType=WinGui');return false;"); %>     
         </hbj:link>
    Regards,
    P.

  • Access SAP BW from Java

    Hello,
    I need to build a Java web application that can collect and display data from various SAP BWs.
    Write operations are not required. What is the easiest way to do that?
    I found that SAP Open Hub Service lets you extract the data to a CSV file or a relational table.
    Assuming I go the way of creating a relational table, the following questions arise:
    - Where are those tables stored? Still within SAP BW or in an external relational DBMS (e.g. an Oracle database)?
    - How can I access those tables from within my Java code (just through a standard JDBC driver)?
    - Who initiates the population of those tables?
    - Can I trigger the extraction at a given time from within my java code?
    - If so, can I hand in filter critera, so that the table is populated only with data that matches my filter, or do I need to extract all data to the relational table and then filter at the next step?
    - Can I have a timer in the SAP BW that creates the table on a certain schedule (e.g. once per day)?
    What other (easier) options are there to achieve this task?
    Thanks,
    MARK
    Edited by: M. Arnold on Aug 17, 2010 9:50 AM

    Mark,
    What you can look at are :
    1. Use a JDBC connector to connect to the database directly - this has some obvious disadvantages because the data would have to be linked with the SID tables , text tables and Dimension tables for cubes which makes the process extremely cumbersome
    2. Use Openhub to extract to a relational table and access the same - possible , but you have two steps in between - openhub to update table and then access the table while maintaining data consistency - this might become a maintenance nightmare once you heavily use this concept
    3. Use web services - there are standard web services like query_view_data and rfc_read_tale which you can use - these web services are SOAP based and you should be able to use the same in your JAVA application
    4. Use the BI JAVA SDK to connect to the backend through an API supported by SAP - this would be easy to use - the SDk should be available on SCN or on the support marketplace and you shoiuld be able to use the same quite easily
    5. Use JCO and build the application using NWDS where you have native connectivity to SAP BW using JCO
    6. Use Web Dynpro JAVA to develop your application where you should be able to access the necessary APIs wherever required.
    Edited by: Arun Varadarajan on Aug 17, 2010 8:15 PM

  • ADF mobile: access app preferences from java

    Hi,
    Jdev 11.1.2.3.0 + mobile extension.
    Where I can find example code or documentation to access preferences (configured in adfmf-application.xml) from java code?
    regards
    Peter

    Thanks!
    It's following part of the document:
    "At the Java layer, an EL value expression is resolved using the following
    approach:
    String val =
    AdfmfJavaUtilities.evaluateELExpression("#{preferenceScope.feature.f0.vendor}")
    regards
    Peter

  • Accessing  table type from JAVA

    Hi Experts,
    We are making a custom copy of the std FM COM_BPUS_ORG_CONTPERS_REGISTER .
    It is observed that Tables are obsolete and we should not use them in custom function modules.
    I can pass a table type in import parameter and export parameter.
    Can we access a table type from java layer.
    Also, note that this STANDARD function module has parameter IT_BUSINESSPARTNERROLE_ORG which has table type BU_ROLE_T.
    Is it possible to access this?
    Note:- This Function module is not getting called in standard web shops.
    Please let me now how i can access this table type for hava while calling FM so as to input or retrieve valus from it.
    Regards
    Antony

    The issue with you is more than accessing a table type.
    You said:
    This Function module is not getting called in standard web shops.
    For function modules that are not called as a part of the standard flow, you have to develop your own simple BOM, BO, BEI, BE classes and methods to call the custom RFC - the whole nine yards. See the extension guide and see the Extension Demos 2 and 3 for reference.
    See the sample JCO calls from Java to understand how to access the table types.

  • How to access physical files from java platform

    Hello All,
    We have one JDE Word Writer program, which export the order master data in the DB2/400 Physical files.
    We want to access this data from our java program (reside on windows platform). I am wondering how we can do that. I got one hint that can be accessed by ODBC connection. But I am unable to get the correct ODBC driver. I am looking for correct driver to access the data.
    If some one has done this already, please help me. Or suggest me any alternate way.
    Dinesh

    Can use File class to write code to examine and manipulate file.
    Tutorial: http://java.sun.com/docs/books/tutorial/essential/io/file.html

  • How to access system calls from java program?

    i am having a doubt regarding accessing system calls from a Java program like accessing unix system calls from a c program.

    Runtime.getRuntime().exec("line command here");
    example:
    Runtime.getRuntime().exec("ls -la");

  • Accessing DLL files from Java

    I have a problem with Java, and the problem is that I'm trying to call a DLL file declared by C++ only but without a support for Java programs, is what I'm aiming for going to be available by using the rundll32.exe file.
    Note: I'm trying to use the (skydll.dll) file for controling skystar2 DVB card.
    Message was edited by:
    JZoro

    You cannot directly call a DLL from Java unless the DLL exposes entry points that are compatible with the JNI calling conventions.
    For example a Java class calling a native function like below:
    class Arguments
       private native void setArgs (String[] javaArgs);
       public static void main (String args[])
          Arguments A = new Arguments();
          newArgs[] = A.setArgs(args);
       static
          System.loadLibrary("MyArgs");
    }Needs a DLL entry point with the following signature:
    JNIEXPORT void JNICALL
    Java_Arguments_setArgs (JNIEnv *jenv, jobject job, jobjectArray oarr) {Notice that the first parameter of the method is of type JNIEnv and the second can be either a reference to a class or Java object instance.
    Jacques Gonzalez
    J4SOFT

  • UnsatisfiedLinkError - Trying to access a DLL from Java

    I am trying to use the Java Native Interface (JNI) to run some C++ code from Java. I tried a simple test program to teach myself that, and it worked perfectly. However, now that I'm tackling a bigger project (A data acquisition program), I get an UnsatisfiedLinkError in the line that calls the function from the DLL.
    Here is the stacktrace: Exception in thread "AWT-EventQueue-0" java.lang.Error: java.lang.reflect.Invoca
    tionTargetException
            at org.jdesktop.application.ApplicationAction.actionFailed(ApplicationAc
    tion.java:859)
            at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(App
    licationAction.java:665)
            at org.jdesktop.application.ApplicationAction.actionPerformed(Applicatio
    nAction.java:698)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:19
    95)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
    a:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    istener.java:236)
            at java.awt.Component.processMouseEvent(Component.java:6263)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
            at java.awt.Component.processEvent(Component.java:6028)
            at java.awt.Container.processEvent(Container.java:2041)
            at java.awt.Component.dispatchEventImpl(Component.java:4630)
            at java.awt.Container.dispatchEventImpl(Container.java:2099)
            at java.awt.Component.dispatchEvent(Component.java:4460)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
            at java.awt.Container.dispatchEventImpl(Container.java:2085)
            at java.awt.Window.dispatchEventImpl(Window.java:2475)
            at java.awt.Component.dispatchEvent(Component.java:4460)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
    ad.java:269)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
    java:184)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:174)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Caused by: java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(App
    licationAction.java:662)
            ... 26 more
    Caused by: java.lang.UnsatisfiedLinkError: fileiotest.dllinterface.startget()V
            at fileiotest.dllinterface.startget(Native Method)
            at fileiotest.dllinterface.start_daq(dllinterface.java:26)
            at fileiotest.FileIOTestView.startrun(FileIOTestView.java:680)
            ... 31 moreI have made sure that the DLL is in the classpath, using both the -classpath tag and by setting the PATH variable. Is something wrong with my DLL itself, perhaps?

    Yes, I have.
    I didn't include the code yet because I thought if someone had similar trouble, there might be something obvious I am overlooking and they wouldn't even need to see the code. I can provide it, however.
    This is the C++ DLL
    // consoledaq.cpp : Defines the entry point for the console application.
    #include <windows.h>                    /* Compiler's include files's */
    #include <string.h>                  
    #include <stdio.h>
    #include "cbw.h"
    #include "stdafx.h"
    #include "dllinterface.h"
    #include "jni.h" //can copy or give full path
    #include <math.h>
    BOOL APIENTRY DllMain( HANDLE hModule,
                           DWORD  ul_reason_for_call,
                           LPVOID lpReserved
        return TRUE;
    #define BOARD_NUM      0                /* Number of A/D board as defined with InstaCal */
    #define BUF_SIZE       10048            /* Size of buffer */
    #define NUM_SECS       10                /* Number of secs to collect data */
    #define ADRANGE        BIP5VOLTS        /* A/D voltage range */
    #define TIMER_NUM      1                /* Windows timer used by this program */
    static HGLOBAL  MemHandle32;       
    /* Variables for AinScan */
    static unsigned short *ADValues;    /* Win32 pointer to A/D buffer */
    static HGLOBAL   ADMemHandle;
    static short     ADCurStatus;       /* Current status for D/A scan */
    static long      ADCurCount;        /* Current count for A/D scan  */
    static long      ADCurIndex;        /* Current index for A/D scan  */
    int              ADOptions;
    long       Count, Rate;
    float      Voltage, Voltage2;
    unsigned short CurValue, CurValue2;
    JNIEXPORT void JNICALL
    Java_daq_startget(JNIEnv *env, jobject obj)
         cbErrHandling (PRINTALL, STOPALL);  /* Set library's error handling */
         ADCurStatus = RUNNING;
         ADCurIndex = 0l;
         ADCurCount = 0l;
         /* Allocate A/D Windows buffer */
         ADMemHandle = cbWinBufAlloc ((long)BUF_SIZE);
         /* Allocate a local WIN32 buffer to hold A/D Data */
         MemHandle32 = GlobalAlloc(GMEM_FIXED | GMEM_DDESHARE, BUF_SIZE *sizeof(short));
         /* Get a 32-bit pointer to the A/D WIN32 buffer */
         ADValues = (unsigned short *)GlobalLock(MemHandle32);
         /* Start up background A/D scan */
         Count = BUF_SIZE;
         Rate = BUF_SIZE / (NUM_SECS * 2);
         ADOptions = BACKGROUND | CONTINUOUS;
         cbAInScan (BOARD_NUM, 0, 1, Count, &Rate, ADRANGE, ADMemHandle, ADOptions);
    JNIEXPORT void JNICALL
    Java_daq_stopget(JNIEnv *env, jobject obj)
         cbStopBackground(BOARD_NUM, AIFUNCTION);  /* Stop A/D subsystem background scan */
         if (ADMemHandle)                 
              cbWinBufFree (ADMemHandle);   /* Free allocated memory */
         if (MemHandle32)
              GlobalFree (MemHandle32);
    JNIEXPORT jfloatArray JNICALL
    Java_daq_getpoint(JNIEnv *env, jobject obj)
         jfloatArray theArray;
         if (ADCurIndex >= 0)
              /* Copy Data from memory to 32 bit memory buffer */
              cbWinBufToArray(ADMemHandle, &ADValues[ADCurIndex], ADCurIndex ,2);
              CurValue = ADValues[ADCurIndex];
              CurValue2 = ADValues[(ADCurIndex + 1)];
         else
              CurValue = 0;
              CurValue2 = 0;
         jfloat tmp[2];
         theArray =  env->NewFloatArray(2);
         cbToEngUnits(BOARD_NUM,ADRANGE,CurValue,&Voltage);                      
         cbToEngUnits(BOARD_NUM,ADRANGE,CurValue2,&Voltage2);
         tmp[0] = Voltage;
         tmp[1] = Voltage2;
         env->SetFloatArrayRegion(theArray, 0, 2, tmp);
         return theArray;
    }And this is the Java class:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package fileiotest;
    * @author Owner
    public class dllinterface {
        public native void startget();
        public native float[] getpoint();
        public native void stopget();
        static {
         System.loadLibrary("daqdll");//This is firstJNI.DLL
         /*if generated by borland
         System.loadLibrary("firstjni");//This is firstjni.dll
        public static void start_daq()
            dllinterface DI=new dllinterface();
            DI.startget();
        public static void stop_daq()
            dllinterface DI=new dllinterface();
            DI.stopget();
        public static float[] get_data_point()
          dllinterface DI=new dllinterface();
          float newtempfloat[];
          newtempfloat = DI.getpoint();
          return newtempfloat;
    }

  • Proplem: Access HTMLB controls from java code

    Hi,
    I am new to iView development for EP6. So my problem should be easy to solve (for you ).
    I created in the NW Dev Studio a JSP DynPage.
    The following files were created or edited:
    1.     JSP file (created)
    2.     java file (created)
    3.     portalapp.xml (edited)
    In order to make the page running (proccessing) I changed the following things:
    1.     JSP file – Add taglib reference to HTMLB-class
    2.     portalapp.xml – Remove the „native“ property so the JSP file will not be accessed directly.
    Now I want to do the following:
    On the JSP page I placed severeal HTMLB controls (textViews).
    From the java code I try to access these controls in the „doProcessBeforeOutput“ method and change/set values.
    But I get all the time a null-Exception.
    Code (JSP)
    <%-- mcmsprovider.jsp --%>
    <%@ taglib uri= "tagLib" prefix="hbj" %>
    <hbj:content id="cntMcmsProvider" >
      <hbj:page title="MCMS Provider Dynpage">
       <hbj:form id="frmMcmsProvider" >
                 <hbj:textView id="tvwScript" encode="false"></hbj:textView>
                 <hbj:textView id="tvwStyle" encode="false"></hbj:textView>
       </hbj:form>
      </hbj:page>
    </hbj:content>
    Code (JAVA):
    public void doProcessBeforeOutput() throws PageException {
           this.setJspName("mcmsprovider.jsp");
           TextView tvw = (TextView) this.getComponentByName("tvwStyle");
           tvw.setText("Here the dynamic text");
    I also tried to add raw text to the form but also null excpetion:
    public void doProcessBeforeOutput() throws PageException {
           this.setJspName("mcmsprovider.jsp");
           Form frmCurrent = (Form) this.getForm();
           frmCurrent.addRawText("<h3>This comes from here</h3>");
    My goal is to dynamically add controls to the form, but until now I think it will be a dream:
    public void doProcessBeforeOutput() throws PageException {
           this.setJspName("mcmsprovider.jsp");
      Form form = (Form)this.getForm();
           TextView tvw  = new TextView("tvwDynamic");
           tvw.setText("Here the dynamic control");
           form.addComponent(tvw);
    The normal page processing runs:
    public void doProcessBeforeOutput() throws PageException {
           this.setJspName("mcmsprovider.jsp");
    Any help is greatly appreciated.

    Eike
    Here is the example straight from the PDK documentation. This should help you a little
    UsingAbstractPortalComponentWithHTMLB.java
    import com.sapportals.htmlb.*;
    import com.sapportals.htmlb.enum.DataType;
    import com.sapportals.htmlb.enum.GroupDesign;
    import com.sapportals.htmlb.event.Event;
    import com.sapportals.htmlb.rendering.IPageContext;
    import com.sapportals.htmlb.rendering.PageContextFactory;
    import com.sapportals.portal.prt.component.AbstractPortalComponent;
    import com.sapportals.portal.prt.component.IPortalComponentRequest;
    import com.sapportals.portal.prt.component.IPortalComponentResponse;
    public class UsingAbstractPortalComponentWithHTMLB extends AbstractPortalComponent {
        //Fill in your output for "normal" content creation mode here
        protected void doContent(IPortalComponentRequest request, IPortalComponentResponse response) {
            IPageContext myContext = PageContextFactory.createPageContext(request, response);
            if (myContext == null) {
                System.out.println("htmlb service did not start up as expected.");
            Form myForm = myContext.createFormDocument("First Experiment");
            Event lastEvent = myContext.getCurrentEvent();
            Group myGroup = new Group();
            myGroup.setWidth("350");
            myGroup.setTitle("First Experiment");
            myGroup.setDesign(GroupDesign.SAPCOLOR);
            myForm.addComponent(myGroup);
            GridLayout gl = new GridLayout();
            myGroup.addComponent(gl);
            if ((lastEvent != null) && (lastEvent.getComponentName().equals("submit"))) {
                String name = myContext.getDataForComponentId("USER_NAME").toString();
                TextView label = new TextView("Hi, " + name);
                gl.addComponent(1, 1, label);
                Button myButton = new Button("goback", "Go back");
                myButton.setOnClick("goBack"); // ignored anyway
                gl.addComponent(2, 1, myButton);
            } else {
                TextView label = new TextView("What's your name?");
                gl.addComponent(1, 1, label);
                InputField inf = new InputField("USER_NAME");
                inf.setType(DataType.STRING);
                gl.addComponent(1, 2, inf);
                Button myButton = new Button("submit", "Tell");
                myButton.setOnClick("submit");
                gl.addComponent(2, 2, myButton);
            myContext.render();

  • Possible to access bean property without Java Bean conventions?

    Hello,
    I'd like to show a component whenever there is an error message in the Faces context. Naively, I set the component's "rendered" attribute to the following:
    rendered="#{facesContext.messages.hasNext}"
    The object returned by facesContext.messages is an iterator, the properties of which do not follow Java Bean naming conventions. If there was a method called getHasNext() then all would be well. However as it stands, EL cannot evaluate this expression.
    I realise that wrapping this up in a managed bean would solve the problem, but I'd like to avoid this if I am able to do this directly from EL.
    Cheers,
    Chris

    Hi Juergen,
    hasNext actually returns a boolean which EL understands fine. In the end I just wrapped the call within a managed bean, as you suggested, and this works a treat:
      public boolean getHasMessages() {
        // hasNext will return true if there are any messages to be displayed
        return FacesContext.getCurrentInstance().getMessages().hasNext();
      }I suppose I felt compelled to post this entry since I found myself having to write some code for an expression that could be written perfectly well in EL but was limited only by the fact that EL can only access properties that follow the Java Bean convention.
    I thought that may have been some qualifier or method wrapper I could have used to mean 'take this property name literally'. Alas, it seems no such faclility exists.
    Thanks for taking the time to reply,
    Chris.

Maybe you are looking for

  • Installation 10g on Windows XP Home Edition

    When I try to install 10g on my Windows XP Home Edition, I get a error message, "oui.exe has encountered a problem and needs to close." Whats that all about?

  • Firefox 4 b8 crashes on program start, there is no error report.

    I just downloaded and installed firefox 4.0 b8. It will not load correctly, and crashes on startup. Sometimes I will see the UI, sometimes I will not. I have reinstalled the program, and I have started the program in Firefox safe mode, and as an Admi

  • Dock at the top of screen?

    I know I might be asking a question asked and answered elsewhere or which might be regarded as silly, but why doesnt the Dock have an option to have it at _+*the top*+_ of the screen as well as Left, Bottom & Right? I sometimes use a 12inch monitor a

  • Attach external files (pdf) to sap tables .

    I have made a report that uses 2 Z tables (header - item) . I have somewhere in my file server some pdf files that i want to connect with each record of my tables . For example the first record has the 1.pdf the second the 2.pdf  etc etc . I thing th

  • Expert - Generating SCD Type2 Mapping for a Table Operator - To Share

    Hi All, I have created an Expert which generates a SCD Type2 Mapping for a Table Operator being used as Dimension. Let me know how I can share this expert. This forum has helped answer many questions and I would like to contribute. Thanks, Sam.