JSF 2.0 where to initialize application wide dynamic collection?

Hi everyone!
Suppose I am developing a website and on the main page I have a list of, say, articles. This list is the same for everyone.
This list is displayed using ui:repeat.
Where should I put the code that gets this list from the database? I want it to be loaded from the database each time someone opens the page, but not more often.
That's what I got:
@Named
@RequestScoped
public class ArticlesBean {
     @Inject
     private ArticlesDao articlesDao;
     private List<Article> allArticles;
     @PostConstruct
     public void initializeBean() {
          System.out.println("ArticlesBean @PostConstruct");
          allArticles = articlesDao.retrieveAllArticles();
     public List<Article> getAllArticles() {
          System.out.println("ArticlesBean getAllArticles");
          return allArticles;
     }But it's called too often (@PostConstruct when I enter the page and when I leave it; getAllArticles is sometimes called 2 times).
How do I go about it?
Edited by: M1keu on Jul 21, 2010 4:15 PM

M1keu wrote:
OK a word of clarification in case someone finds this post...
I used @Named instead of @ManagedBean and that gave me weird results. You should use @ManagedBean apparently (at least with @ViewScoped; then it would even be logical).
I used @ViewScoped and now my dynamic collection is refreshed upon entering the page (good), not refreshed upon leaving the page (good), not refreshed when validation fails (bad). If that bothers you as well, I'm trying to get some answers here: http://forums.sun.com/thread.jspa?threadID=5445656.
That would be what I would expect. When validation fails you keep the same view so a view-scoped bean would be preserved.
As to the session scoped bean I referred to earlier, I forgot half the trick (sorry about that). You have two beans, a request-scoped bean X and a session-scoped bean Y. Bean Y loads the actual data. Everything accesses the data through bean X. Every method in the bean X which accesses the list first calls a method to determine if the list should be reloaded. The method checks that FacesContext.getRenderResponse() is true and that the list has not been refreshed before; if both are true, reload the list from the database and set the flag to indicate the list has been reloaded. Since bean X is request-scoped, the flag gets reset automatically.

Similar Messages

  • Right place to initialize application level items

    I initilized application items on page 1 (home page for application). The normal flow for this application is the way when user gets their authentication at startup and then is normally redirected to the home page where application items are initialized.
    This logic doesn't work when user gets (for example from a colleague) direct link to a particular page inside application. In that case after successfull authentication APEX redirects user to this page and my application items remain undefined.
    What's the right place to initialize application items? I need initialize them first whenever user starts my application and regadless how they enter.

    The Authentication Schemes used in both apps is SSO.
    All pages require authorization. The schemes call a PL/SQL function accpeting a parameter of APP_USER and return a Boolean of whether this type of access is granted to that user.
    Since all pages require authorization, navigating to any page causes SSO to be called and on authentication the authorization schemes are called to determine whether the user is authorized to see the page. If so, it will load ...
    The code I have in the Post-Authentication Process is as follows (I'm pretty sure it doesn't fire because the row is not inserted => see note below ..):
    declare
    v_app_user VARCHAR2(7);
    begin
    v_app_user := SUBSTR(:APP_USER,1,7);
    INSERT INTO profitauto.portf_front_end_login_log
    (stdrd_id
    , login_time
    VALUES (v_app_user
    , SYSTIMESTAMP
    COMMIT;
    end;
    It seems to me to make sense that it doesn't fire if the user is authenticated in another app. Or is the authentication still happening in this app (just not prompting SSO to pop-up again to the user)...? Please note. If I have not authenticated myself already, and login to this app, the record IS written to the table ...

  • Application wide Variable

    What is the best way to implement an Application wide Variable.
    Here is what I want to accomplish. We have several users enter different data into Database. I want to filter the data the users see based on a column will call it Group that is in every table.
    My thinking was to put a dropdown on the login page or some page and they would choose which Group's data they want to see.
    Then on every page the queries for that page would have a where clause that would say where Group = :MY__APP_Variable.
    I am not sure if one this is the best way to accomplish this,
    and two if it is the best way I am not totally sure how to fully implent the app parameter.
    I am thinking I would create some type of variable under shared components
    then when they select the value from the drop down on the login I would make the variable equel to that.
    I am just not sure exactly how to do this.
    Thoughts??
    Thanks

    qtjr, I asked you about the number of reports, so that if you have less number of reports then you can have the option for changing the group on the report screen instead of going to the first page for changing it. You have 50 or more reports, so this probably will not be a good option. Allow the user to select a group after they login and set the value to an application level item.
    You can use a page level item but I think an application level item will be a better option.
    Thanks,
    Machaan

  • Error: Cannot initialize application data. when trying to start JSPM

    Hi All
    I get the an error when trying to open the D:\usr\sap\SLM\DVEBMGS00\j2ee\JSPM\go.bat on Windows 2003. I am trying to run the JSPM. Could find much info about the exact problem. Please advice.
    Trouble Ticket Report
    Java Support Package Manager for SAP NetWeaver'04s
    SID................: SLM
    Hostname...........: gpisolides
    Install directory..: D:/usr/sap/SLM
    Database...........: Oracle
    Operating System...: $(/J2EE/StandardSystem/CentralInstance/J2EEEngineInstanceHost/OpSysType)
    JDK version........: 1.4.2_16 Sun Microsystems Inc.
    JSPM version.......: 7.00.12.0.1.7.21
    System release.....: 700
    ABAP stack present.: true
    The execution ended in error.
    Cannot initialize application data.
    Could not extract value with key SAPSYSTEM from file D:/usr/sap/SLM/SYS/profile/SLM_DVEBMGS00_gpisolides. A possible reason could be that the path to the directory containing the sappfpar executable is not included in the PATH environment variable. Could not start process sappfpar. Error while executing process sappfpar.java.io.IOException: CreateProcess: sappfpar pf=D:/usr/sap/SLM/SYS/profile/SLM_DVEBMGS00_gpisolides SAPSYSTEM error=2
    More information can be found in the log file D:\usr\sap\SLM\DVEBMGS00\j2ee\JSPM\log\log_2008_08_05_15_22_30\JSPM_MAIN_1_01.LOG.
    Use the information provided to trouble-shoot the problem. There might be an OSS note providing a solution to this problem. Search for OSS notes with the following search terms:
    com.sap.sdt.jspm.phases.PhaseTypeJSPM
    com.sap.sdt.jspm.gui.JspmUiException
    Cannot initialize application data.
    JSPM_MAIN
    JSPMPhases
    NetWeaver Upgrade
    SAPJup
    Java Upgrade
    Thanks
    Krishna KK

    Can you execute this command manually when you login as "slmadm":
    sappfpar pf=D:/usr/sap/SLM/SYS/profile/SLM_DVEBMGS00_gpisolides SAPSYSTEM
    Markus

  • Where is the Application Sharing defaulttrace.trc file located?

    Hi,
    In a help document it says this:
    a.      Set the Application Sharing Server trace file (defaultTrace.trc) to severity info and try to start a new session.
    but where is the Application Sharing file located? or it means the J2EE defaultTrace file?
    Thanx in Advanced!
    Kind Regards,
    Gerardo J

    Hi Gerardo,
    Collaboration uses the logging mechanisms of the J2EE Engine. Therefore it is the defaultTrace.trc  under .../usr/sap/<SID>/Jxx/j2ee/cluster/serverX/log/ .
    Kind regards
    Klaus

  • I updated my iMac to Mountain Lion and when I want to fit my screen view... in the last version I had to examples where I could choose wide after format but I miss that function now in Mountain Lion. Can anyone please help me???

    I updated my iMac to Mountain Lion and when I want to fit my screen view... in the last version I had to examples where I could choose wide after format but I miss that function now in Mountain Lion. Can anyone please help me???

    I'm sorry for my bad english, my problem is that I want the program I open in a new window to be avilable in full screen mode. Before I uppdated my os to Montaine Lion I could choose wide under screen in settings. I'll take an ex for you. When I play poker online I want to see the tabel in full screen but I don't manage to fix that. Do you Sir have any idea???

  • Application-wide "env-entry"

    Hi,
    I'm creating a J2ee application using various EJB's and at least one WAR, all inside one single EAR file.
    This app. is to be intalled at different clients. I'd like to be able to specify different properties ( server used, remote host addresses, etc.) in some part of the EAR that will be available using
    (String)context.lookup("java:comp/env/" + name );
    I have been able to customize individual EJB's using the <env-entry> tag in its DD but what about the being able to customize the whole application??
    I'm been scouring docs and the net and I can't see any specific application.wide examples.
    Many thanks for your help.
    Terry Doyle

    I faced the same problem some time ago. I went through the EJB 2.0 spec and the DTD of ejb-jar.xml. It appears that env-entry is for an EJB only. There is no 'global' env-entry.

  • JSPM - Cannot initialize application data

    Dear All,
    I am getting below issue when i am trying to run JSPM.
    Connecting to SDM Server on host SOLMAN01, port 50018...
    You can find additional information in SDM log file
    If SDM has performed no action, this file does not exist.
    Retrieval of SDM substitution variables has finished.
    Checking status of instance 0 on host SOLMAN01..
    Exception has occurred during the execution of the phase
    Cannot find instance with instance number 0 on host SOLMAN01 in the cluster.
    Could not determine if instance 00 on host SOLMAN01 is running.
    Cannot initialize application data.
    Phase JSPM/JSPMPhases/JSPM_MAIN has been completed.
    I have search a lot & checked this note 1600846 but still facing same issue. Your help will be appreciated.
    Regards,

    hi Divyanshu,
    first i shared main log. now sharing more logs. please find attached.
    Trouble Ticket Report
    Java Support Package Manager for SAP NetWeaver'04s
    SID................: SOL
    Hostname...........: SOLMAN01
    Install directory..: F:/usr/sap/SOL
    Database...........: Microsoft SQL Server
    Operating System...: $(/J2EE/StandardSystem/CentralInstance/J2EEEngineInstanceHost/OpSysType)
    JDK version........: 1.4.2_30 Sun Microsystems Inc.
    JSPM version.......: 7.02.11.1.1
    System release.....: 700
    ABAP stack present.: true
    The execution ended in error.
    Cannot initialize application data.
    Could not determine if instance 00 on host SOLMAN01 is running.
    Cannot find instance with instance number 0 on host SOLMAN01 in the cluster.
    More information can be found in the log file F:\usr\sap\SOL\DVEBMGS00\j2ee\JSPM\log\log_2014_06_17_14_07_00\JSPM_MAIN_1_01.LOG.
    Use the information provided to trouble-shoot the problem. There might be an OSS note providing a solution to this problem. Search for OSS notes with the following search terms:
    com.sap.sdt.jspm.phases.PhaseTypeJSPM
    com.sap.sdt.jspm.gui.JspmUiException
    Cannot initialize application data.
    JSPM_MAIN
    JSPMPhases
    Java Support Package Manager
    I update latest jspm but faced same error. Please check other attached logs.

  • JSPM shows a "Cannot initialize application data" error

    Hi all
    When I start the jspm (go.bat) on my Solution Manager I get an error message after the login process. I attached the Trouble Ticket Report of the JSPM below (I made it anonymous). It is not a login issue (when I enter a wrong password, I get a different error message).
    What I already tried:
    - Updating the jspm (with SDM -->Remote Gui).
    - Deleting old files in profile Folder.
    - Checking if there is a "...U" folder in the kernel dir (as described in a note concerning this problem).
    - Stop/Start of the entire server.
    - Searching for hours in google/SDN/service.sap.
    I noticed on the start of the server that the sapcpe.exe Service (shown in sapmmc) is on "red" ("Could not bestarted") > I replaced all sapcpe.exe files in all kernel directories> Still red. Perhaps both problems are in context?
    Trouble Ticket Report
    Java Support Package Manager for SAP NetWeaver'04s
    SID................: ***
    Hostname...........: ***
    Install directory..: H:/usr/sap/***
    Database...........: Oracle
    Operating System...: $(/J2EE/StandardSystem/CentralInstance/J2EEEngineInstanceHost/OpSysType)
    JDK version........: 1.4.2_15 Sun Microsystems Inc.
    JSPM version.......: 7.00.17.3.01
    System release.....: 700
    ABAP stack present.: true
    The execution ended in error.
    Cannot initialize application data.
    Could not detect deployed components.
    Could not detect version information of the current system kernel.
    Could not detect system kernel under the H:\usr\sap\***\SYS directory.
    Could not detect central services instance kernel in directory H:\usr\sap\***\SCS01\exe.
    Could not detect current system kernel in the H:\usr\sap\***\SCS01\exe directory.
    disp+work executable file cannot be run.
    Could not start process H:/usr/sap/***/SCS01/exe/disp+work.
    Error while executing process H:/usr/sap/***/SCS01/exe/disp+work.
    java.io.IOException: CreateProcess: H:/usr/sap/***/SCS01/exe/disp+work -V error=2
    Use the information provided to trouble-shoot the problem. There might be an OSS note providing a solution to this problem. Search for OSS notes with the following search terms:
    com.sap.sdt.jspm.phases.PhaseTypeJSPM
    com.sap.sdt.jspm.gui.JspmUiException
    Cannot initialize application data.
    JSPM_MAIN
    JSPMPhases
    Java Support Package Manager
    Does anyone know how to fix this problem?
    Thanks in advance for your help.
    Regards
    Marco

    Hi Manoj,
    Thanks. I copied the files manually to \usr\sap\<SID>\SYS\exe\nuc\NTAMD64. As I can see in the sapcpe.log the files now are automatically transfered to the second kernel dir (:\usr\sap\<SID>\DVEBMGS00\exe). Unfortunately for my Java SCS Instance (scs01) the sapcpe.exe is still red in sapmmc (I had already replaced the sapcpe.exe in the scs01 exe dir). In the sapcpe.log file of the SCS01 I see the following error:
    source:
    hostname\sapmnt
    SYS\exe\NUC\NTAMD64
    target:
    hostname\sapmnt
    SYS\exe\run
    ERROR: sapcpe: find <dst>
    hostname\sapmnt
    SYS\exe\run failed, 2, No such file or directory, [sapxxcpe.c:1451]
    That doesn't make sense... there is no SYS\exe\run ... I only have a SYS\exe\NUC...
    Regards
    Marco

  • Please where is my applications folder?

    Hey
    I want to restore my mini.
    I went to http://docs.info.apple.com/article.html?artnum=60983
    and got stuck on No3
    # Open the iPod Software Updater application. It's in the Utilities folder, which is in your Applications folder.
    Please where is my applications folder?
    Cheers Kel

    Also, make sure that you're actually logged in as the same user that you had in Panther - you can check under the Users folder to see if there's another user. You won't be able to search other users' folders in Spotlight, so you will have to log out and in to get those files, if they're there.
    Matt

  • Where is my application directory?

    I use Mac OS X v10.4.11 Tiger.  Where is my application directory?

    On the Desktop double click on your Hard Drive icon, (usually called Macintosh HD), look for a folder called Applications... directory is another name for folder.

  • Making buttons in application toolbar dynamic....

    Hello,
    I have a application tool bar with 8 icon buttons defined. Now I have a custom configuration table where I check what buttons in application toolbar should be seen so that user can select which button he wants to see and which not anytime he wishes.
    My question is how can  I make buttons in application toolbar dynamic ?
    Please guide.
    Regards,
    Rajesh.

    This is sample logic, but you can adapt it to you needs
    DATA: excl_tab   TYPE sy-ucomm OCCURS 0 WITH HEADER LINE.
      AUTHORITY-CHECK OBJECT 'ZREO'  ID 'ACTVT' FIELD c_print.
      IF sy-subrc NE 0.
        APPEND 'PRIN' TO excl_tab.
      ENDIF.
      IF ok_0010 = 'DISP' OR ok_0010 = 'DELE'.
        APPEND 'SAVE' TO excl_tab.
      ENDIF.
      IF ok_0010 <> 'DELE'.
        APPEND 'DELE' TO excl_tab.
      ENDIF.
      SET PF-STATUS 'STAT_100' EXCLUDING excl_tab.

  • Server 2012 RS Multiple RDS Collections equals only one application from one collection at a time

    Hello all!
    We have a 2012 R2 RDS "farm" configured like this:
    2 RD Web Access servers (load balanced behind KEMP appliances)
    2 RD Connection Brokers in a High Availability configuration
    8 RD Session Host servers (no VDI) in 2 different collections
    I've noticed that if I have rights / visibility to different applications in both collections I can only run one of the applications at a time.  For instance:
    Collection A has application 1
    COllection B has application 2
    What i'm experienceing now is that if i have rights to app 1 and app 2 i can only use one at a time.  If i attemp to run app 2 while i have app 1 open I get this message:
    "Windows cannot start the RemoteApp program.  The following RemoteApp program is not in the list of authorized programs: app 1"
    Maybe my thinking is incorrect and you cannot cross boundries from one collection to the other.  Maybe i need one collection with all my host and segregate applications via AD permissions.  Any thoughts?

    Hi,
    Please make sure the client PC has mstsc.exe 6.3.9600 (RDP 8.1) or later.
    From your description it sounds as though it is attempting to connect to the wrong collection when you launch the RemoteApp for the second collection.  This can be caused by older client version and/or your load balancing configuration.  You should
    load balance the initial connections to the broker, but not use a load balancer for the connections to the RDSH servers, unless you have a specific need to.  The RD Connection Brokers will handle the load balancing for the RDSH servers.
    Thanks.
    -TP

  • Declare and initialize a varray of collection Object and pass it as OUT Par

    Hi ,
    How to declare and initialize a varray of collection Object and pass it as OUT Parameter to a procedure.
    Following is the Object and VARRAY Type 's I have created and trying to pass the EmployeeList varray type variable as an OUT parameter to my stored procedure, but it is not working. I tried different possibilities of declaring and initializing the varray type variable but it did not work. Any help would be appreciated.
    CREATE TYPE Employee IS Object
              employeeId     Number,
              employeeName VARCHAR2(31),
              employeeType     VARCHAR2(20),
    CREATE TYPE EmployeeList IS VARRAY(100) OF Employee;
    /* Procedure execution block */
    declare
    employees EmployeeList;
    begin
    EXECUTE displayEmployeeDetails(100, employees);
    end;
    Thanks in advance,
    Raghu.

    but it is not workingWhat's the definition of not working?
    Error messages are always helpful.
    SQL> CREATE OR REPLACE TYPE Employee IS Object
      2  (
      3  employeeId Number,
      4  employeeName VARCHAR2(31),
      5  employeeType VARCHAR2(30)
      6  );
      7  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE EmployeeList IS VARRAY(100) OF Employee;
      2  /
    Type created.
    SQL> CREATE OR REPLACE PROCEDURE getEmployeeDetails (
      2    o_employees OUT employeelist
      3  )
      4  AS
      5  BEGIN
      6   o_employees := employeelist();
      7   o_employees.EXTEND;
      8   o_employees(1) := employee(1,'Penry','Mild Mannered Janitor');
      9  END;
    10  /
    Procedure created.
    SQL> set serveroutput on
    SQL> declare
      2   employees employeelist;
      3  begin
      4   getemployeedetails(employees);
      5   for i in 1 .. employees.count
      6   loop
      7    dbms_output.put_line(employees(i).employeeid||' '||
      8                         employees(i).employeename||' '||
      9                         employees(i).employeetype);
    10   end loop;
    11  end;
    12  /
    1 Penry Mild Mannered Janitor
    PL/SQL procedure successfully completed.
    SQL>

  • HT1399 I have 11,000 songs on my iPod Classic but since downloading the new itunes software I am having trouble locating where I can view my full collection of songs. Can anyone tell me where I can view these please?

    ! have 11,000 songs on my iPod Classic but since downloading the new version of itunes software I am having trouble locating where I can view my full collection to edit/delete. I can add music and see the additions cannot see the full list. Can anyone tell me where I can view them please?

    Here is what worked for me:
      My usb hub, being usb2, was too fast. I moved the wire to a usb port directory on my pc. That is a usb1 port which is slow enough to run your snyc.

Maybe you are looking for