Application scope problem in a JSP

Hi,
I try to store an object with the following code :
getServletContext().setAttribute("application", app);
Later I want to access this object from a JSP with :
<jsp:useBean id="application" scope="application" class="de.skillworks.SWApp"/>
that dosn't work !? I can not debug my application because the jsp is initializing my app object new. When I try in my JSP :
SWApp app = (SWApp)pageContext.getServletContext().getAttribute("application");
it works fine. I get my object which I have store in my servlet.
In a Tomcat environment my code is working just the Jdeveloper has a problem with it.
null

Andy -
The web-to-go server has difficulty dealing with sessions. Testing in Tomcat is a good alternative, and this is resolved in Oracle9i JDeveloper.
Hope this helps,
Lynn

Similar Messages

  • Problem in creating Jsp Page.

    i am working on bulletin board Project.
    now my problem is that how to create Dynamic Page.
    Suppose :-
    i have created a Jsp page in that page there are 4 Categories like ( Java , dot net , PHP , XML ).
    ok
    Now when u click on it suppose java a new jsp page will open if u logdin through yout login ID the u can able to post any thing related to java lie Quation or Ans etc.
    ok
    now u have posted a quation now the problem is that wen u have posted a quation in java section it will stored in database but how can i display that quation in new page & if some one reply to that Quation the how can i display that Ans just under that quation.
    At that moment i have to create a jsp page Dynamically. i am right so how can i do that PL help me i have to submit my project withen 3 to 5 days in my collage PL.
    PL Hellp me & tell me how to do that.
    Thanks
    HARSH

    It is generally a bad idea to start threads in JSPs and Servlets. However, there is a need for them ... sometimes... Stress the rarety of sometimes. If you want to cancel the TimeTask, then chances are you don't want the Timer running from your JSP.
    To answer your question, how is the Timer/TimerTask objects you are working with stored? To make changes, they would need to be stored in some scope where they can be accessed later. That means session if you want different users to have dirrerent tasks. application scope if all users should control the same task (be careful with this, you may have problems with synchronization issues).
    I would think there is probably a better solution to your problem. Maybe if you explain in more detail, we can come up with a better one.

  • Killing a bean with application scope?

    Is there any way to kill a bean with application scope?
    I am writing a web application, that most likely the browser window will never be closed. The problem is a user is authenticated onto our site but because the bean containing the users acct info is application scope, if another user logs in it still shows the old user as logged in. So on logout i would like to kill the application, the bean, servletContext...anything that will refresh the bean and the corresponding jsp. Any help is much appreciated.

    There is an indirect way if you know servlets. The "application" implicit object that you use in your JSP is the javax.servlet.ServletContext object. Instead of declaring your bean using the jsp:useBean tag, directly put your objects into the ServletContext using ServletContext.putAttribute() method. Objects put in the ServletCOntext are available to all pages in the application. Just use the ServletContext.getAttribute() method to retrieve this bean in any other page.
    To "kill the bean", just reset the value of this object to null by calling putAttribute(null).

  • Beans scope problem

    Hi
    I have a bean that stores the name of the user after they have logged in. It is supposed to be in session scope
    <jsp:useBean id="userInfo" class="beans.UserInfo" scope="session"/>But it appears to have been placed in application scope. It doesn't timeout and all subsequent users appear to be logged on as the first user. This is not good.
    Any suggestions? I'll post the code once I've made a minimal version of the problem.
    Thanks
    Richard

    Here's the code
    the bean: UserInfo.class
    package beans;
    public class UserInfo implements java.io.Serializable  {
      private static boolean loggedIn=false;
      private static String user="";
      public UserInfo() { }
      public static void setLoggedIn(boolean b){loggedIn=b;}
      public static void setUser(String b){user=b;}
      public static boolean isLoggedIn(){return loggedIn;}
      public static String getUser(){return user;}
    }main jsp page test.jsp
    <jsp:useBean id="userInfo" class="beans.UserInfo" scope="session"/>
    <jsp:include page="header.jsp" flush="true">
       <jsp:param name="title" value="Test" />
    </jsp:include>
    <%
      boolean login=Boolean.valueOf(request.getParameter("login")).booleanValue();
      if(login){
          userInfo.setLoggedIn(true);
          userInfo.setUser("strUsr");
    %> 
    <p><b>mainpage says</b>
    <%if (userInfo.isLoggedIn()) {%> <%=userInfo.getUser()%> logged in
             <%}else {%>not logged in
                <%}%>
    </body>
    </html>The included file header.jsp
    <jsp:useBean id="userInfo" class="beans.UserInfo" scope="session"/>
    <html>
    <head>
    <title><%=request.getParameter("title")%></title>
    </head>
    <body>
    <p><b>header says</b>
    <%if (userInfo.isLoggedIn()) {%> <%=userInfo.getUser()%> logged in
             <%}else {%>not logged in
                <%}%>load test.jsp?login=true in a browser
    load test.jsp in another browser - should not appear logged in - but does at least with my system (tomcat 5.5.9 on windows xp)
    Any suggestions,
    Richard

  • Updating Beans in Application Scope

    The problem is that i dont know how to update a bean in an application scope:
    in EA4 i use this instruction to update a bean property:
    // get the faces context
    FacesContext facesContext = FacesContext.getCurrentInstance();
    // update a property in application scope
    (Util.getValueBinding("BeanName.propertyName")).
    setValue(facesContext,"text");
    and it worked ok in jsp:
    <h:output_text valueRef="BeanName.propertyName" />
    Now in version 1.0 i wrote:
    Application app = facesContext.getApplication();
    errorAplicacion = (ErrorAplicacion)app.createValueBinding("#{beanName}").
    getValue(facesContext);
    How should i update this value in application scope to be used in the jsp ?
    I use in jsp:
    <h:output_text value="#{BeanName.beanProperty}"/>
    But i receive in logs:
    Expression BeanName.beanProperty does not follow the syntax #{...}
    And the result is null
    Thanks a lot
    German

    If you are quoting your 1.0 code literally, you've got a case mismatch between "#{beanName}" when you create the value binding expression and "#{BeanName}" in the JSP page. As with most things in Java, the names are case sensitive.
    Craig McClanahan

  • Jsf problem go from jsp page to another jsp in new window

    I’ve two jsp pages attendReport.jsp and printAttendReport.jsp
    attendReport.jsp contains inputs for attend duration and employee id and command button “view” to view attendance data entered employee during entered duration inside the same page(this work very good)
    the problem is the same page includes another command button “print” its job is to get the same data but view them in the second page printAttendReport.jsp in another window in order to print the data in some suitable format , but the print button opens attendReport.jsp instead of printAttendReport.jsp and does not hold the inputs else if I set <managed-bean-scope> to session not request which cause caching data , please help me if you to solve this problem
    and here the related lines of code
    <faces-config >
    <managed-bean>
    <managed-bean-name>attendReportBean</managed-bean-name>
    <managed-bean-class>csc.attend.bean.AttendReportBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <navigation-rule>
    <from-view-id>/attend/attendReport.jsp</from-view-id>
    <navigation-case>
    <from-action>#{AttendReportBean.attendReport}</from-action>
    <from-outcome>attendReport</from-outcome>
    <to-view-id>/attend/attendReport.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    <navigation-rule>
    <from-view-id>/attend/attendReport.jsp</from-view-id>
    <navigation-case>
    <from-action>#{AttendReportBean.printAttendReportAction}</from-action>
    <from-outcome>printAttendReportAction</from-outcome>
    <to-view-id>/attend/printAttendReport.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    </faces-config> // here is managed bean code
    public class AttendReportBean {
    // data , getters and setters
    init();
    //Preload in initialization block.
    public void init() {
    // initialize data
    public String attendReport() {
    // code to get attend data to go to view page(same page) it is ok
    return "attendReport"; // Navigation case.
    public static String getRequestParameter(String name) {
    return (String) FacesContext.getCurrentInstance().getExternalContext()
    .getRequestParameterMap().get(name);
    public void printAttendReportListener(ActionEvent event) {
    String fromYearStr = getRequestParameter("fromYearAtt");
    System.out.println("fromYearStr = "+fromYearStr);
    // try to get inputs through ActionListener but it gives me null
    public String printAttendReportAction() {
    // code to get attend data to go to print page(another page in new //window) but inputs come in default values
    return "printAttendReportAction"; // Navigation case.
    }attendReport.jsp
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <f:view>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    //title . styles and validations //
    </head>
    <body>
    <h:form id="attendReportForm">/the form tag appear in running source as <form id="attendReportForm" method="post" action="/newdiwan/faces/attend/attendReport.jsp" enctype="application/x-www-form-urlencoded" >
    i.e. it always submit to attendReport.jsp page
    / some inputs and outputs /
    <h:commandButton onclick="return check();" id="view" action="#{attendReportBean.attendReport}" value="" styleClass="linksNumBlue" />//it works good/
    // some outputs to view data /
    <h:commandLink immediate="true" id="printLink" value="" action="#{attendReportBean.printAttendReportAction}" actionListener="#{attendReportBean.printAttendReportListener}" target="_blank" styleClass="linksNumBlue">
        <f:attribute  name="fromYearAtt" value="2009" />
        <f:attribute  name="fromMonth" value="01" />
       <f:attribute  name="toYear" value="2010" />
       <f:attribute  name="toMonth" value="06" />
    </h:commandLink>//this has two problems 1)submit to attendReport.jsp not printAttendReport.jsp which I want to go to.
    //2)does not get the inputs but return the default values only /
    </h:form></body></html></f:view>I use libraries { jsf-api.jar , jsf-impl.jar , jstl-1.1.0.jar and tomahawk-1.1.6.jar } and deploy on tomcat 6.0
    I’m sorry for the prolongation, please help me if you can
    Edited by: alynoor on Jul 8, 2010 1:51 AM
    Edited by: alynoor on Jul 8, 2010 1:55 AM

    my problem solved 1- i use 2 managed bean , one of request scope (used in attendReport.jsp ) and the other with session scope (used in printAttendReport.jsp)
    2 - add new jsp contains the h:commandLink of the print (attendReportPrintAction.jsp)
    3 - divide the view of attendReport.jsp to two subviews (each subview has its own form) one contains inputs and outputs of attend and the other contains include to (attendReportPrintAction.jsp)
    <%@ include file="attendReportPrintAction.jsp" %>
    4 - send and get parameters using two methods
                public static Object getSessionMapValue(String key) {
                   return FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(key);
                public static void setSessionMapValue(String key, Object value) {
                   FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(key, value);
                }faces-config.xml
       <managed-bean>
          <managed-bean-name>attendReportBean</managed-bean-name>
          <managed-bean-class>csc.attend.bean.AttendReportBean</managed-bean-class>
          <managed-bean-scope>request</managed-bean-scope>
       </managed-bean>
        <managed-bean>
          <managed-bean-name>print_attendReportBean</managed-bean-name>
          <managed-bean-class>csc.attend.bean.AttendReportBean</managed-bean-class>
          <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>
    <navigation-rule>  
        <display-name>viewReport</display-name>  
        <from-view-id>/attend/attendReport.jsp</from-view-id>  
        <navigation-case>  
            <from-action>#{AttendReportBean.attendReport}</from-action>
            <from-outcome>attendReport</from-outcome>  
            <to-view-id>/attend/attendReport.jsp</to-view-id>  
        </navigation-case>  
    </navigation-rule>
    <navigation-rule>  
        <display-name>printReport</display-name>
        <from-view-id>/attend/attendReport.jsp</from-view-id>  
        <navigation-case>  
            <from-outcome>printAttendReportAction</from-outcome>  
            <to-view-id>/attend/printAttendReport.jsp</to-view-id>  
        </navigation-case>  
    </navigation-rule>attendReportPrintAction.jsp
    <f:subview id="printAttendReportSubView" >
    <h:form id="printAttendReportForm" onsubmit="return check222();" >
                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td width="11%">
                                    <table width="70" border="0" cellpadding="0" cellspacing="0">
                                        <tr>
                                          <td width="7" height="28"><img src="../images/B-left.gif" width="7" height="28" /></td>
                                          <td align="center" background="../images/B-bg.gif">
                                            <!--a href="printAttendReport.jsp" class="linksNumBlue" target="_blank" >&#1591;&#1576;&#1575;&#1593;&#1577;</a-->
    <h:commandLink id="printLink" value="&#1591;&#1576;&#1575;&#1593;&#1577;" title="&#1591;&#1576;&#1575;&#1593;&#1577;"  action="#{print_attendReportBean.printAttendReportAction}"   target="_blank"  styleClass="linksNumBlue">
                                        </h:commandLink>
                                            </td>
                                          <td width="7" height="28"><img src="../images/B-right.gif" width="7" height="28" /></td>
                                        </tr>
                                      </table>
                                      </td>
                                    <td align="right"> </td>
                                  </tr>
                                </table>
    </h:form>
    </f:subview>i hope this helps someone

  • Accessing Application Scope from an EJB

    I'm not sure of the best way of doing this:
    The set up:
    We have a rather large J2EE application that is composed of only servlets and JSPs at the moment (When the application began development EJB was in its infancy and not feasible for the development of the app). Some of the new deployments of the app involve distributed webserver over 4 JVMs and 2 machines. When a user connects the servers load balancing decides which particular JVM they should be connected to. We perform large data caching into the servlet application scope to avoid having to access the database every time a change is made by a user to certain tables in our database. The data caches are stored in hashtables in the servlet application scope.We seem to have no way to determine what other JVMs are running or which JVM a user is currently connected to.
    The problem:
    Apparently the application scope is for a particular JVM. This means that when a user makes a change to a data cache the change doesn't effect users in the other 3 JVMs of the application, only the users who, due to load balancing, happened to be connected to the same JVM as the one where the change was made.
    Our possible solution:
    We were thinking that we could set up a queue (such as MQSeries from IBM) and any time a change is made to one of these data caches put a message on the stack saying that the particular table had been updated. Then a MDB would be listening asynchronously and digest the message from the Queue and recache the tables from the database.
    So here are my questions:
    1. Would this work? Would putting a MDB in the EJB Container give each JVM the MDB in the first place, or would this mean it would pick one of the JVMs to deploy the MDB on and still not fix our problem.
    2. If this does work, how do I access the hashtables stored in the Servlet Application scope from the MDB. I can't seem to find any method available to the MDB (or any EJBs for that matter) that can access the servlets Application scope.
    3. Is this the best way to do this? Or is there a better way to share data between seperate JVMs that I don't have a URL to (It's all ambiguous and handled by the server as to which JVM actually gets the connection.)
    Just in case this is needed:
    We are running IBM WebSphere 5 Application Server and the database could be anything from DB2 to Oracle.
    Thanks in advance for any possible help.

    You wont get any api for directly accessing Servlet application objects from any ejb. I dont think MDB either solves your problem directly. Indirectly you can place a request to some servlet (should be there for each JVM and web application ) and update your application scope variable. I would suggest you to cache the data in database if the size of cache is large. otherwise any open caching tools may help you.

  • Facing error as Not in an application scope - start Orion with the -userThr

    hi all,
    iam facing this error when an jsp which is in Oracle portal(emebedded in iframe code) is updating a flag in database through a datasource configured on portal side.
    Naming Service=Not in an application scope - start Orion with the -userThreads switch if using user-created threads
    regards,
    Ravi

    I encounter the same issues when using the TimerTask to access the JNDI tree. I have found success when I move my business logic to an EJB and call my EJB from my TimerTask. It's a bit more work, but not much. The EJB inherits it's identity based on it's configuration and has no trouble accessing the JNDI tree whenever it's called. Try this and see if your problem doesn't go away.
    Hope this helps,
    Perry Tew

  • Is Weblogic Cluster  supports Application scope Objects?

              Our Application is mainly depends on Application scope objects. On one m/c, it
              is perfect.
              Now, we want to support the failover , load balancing ... (High Availability).
              I know, weblogic cluster supports HttpSessions, EjbObjects ... etc. What about
              Application scope objects.
              we are planning for weblogic server which supports the our requirements.
              If not, what is the solution to make it work by using Weblogic server.
              for eg: I can give what type of application we are developing --- similar to
              textchat.
              our application is real time application.
              

    Even a singleton is not good enough as singletons are good only in the VM they were
              created it. One way is to have a distributed object such as a stateful session bean of
              which only one instance exists. U can create it at startup and store its handle in
              some persistent storage as well as a singleton. This ensures that even if the
              singleton doesnt contain it the refgerence to it can be obtained.
              There will be some problems with this setup as people should not allow it to create
              instances of it . Any such endeavor will lead to a CacheFullException.
              But essentially that seems possible.
              Even the 2.3 Servlet specification mandates that ServletContext and Application level
              object is only valid inside the JVM which created it. HttpSessions are replicated
              SessionContexts are not and are not likely to be in any J2EE application server
              Sameer
              Devi wrote:
              > One more comment from my side,
              > U mentioned "EXCEPT FOR JNDI" , if this is possible, how can we acheive?
              > Can U give brief description ? Take textchat example itself? since, our application
              > is almost have same mechanism. If it is < 1 sec delay means acceptable for this
              > release.
              >
              > Thanks,
              > Devi
              >
              > "Cameron Purdy" <[email protected]> wrote:
              > >Weblogic doesn't support replicated / synchronized app scope objects
              > >across
              > >a cluster except for JNDI, which is probably not a good solution for
              > >what
              > >you are describing.
              > >
              > >If you need a real-time shared fault-tolerant fail-overable high-performance
              > >load-balanced high-scale data store, then let me know when you find one
              > >;-)
              > >.... seriously, there are not a whole lot of good general purpose solutions
              > >in this space. There are some things to look at but they are all expensive:
              > >
              > >Persistent PowerTier on top of Oracle - a caching entity EJB server
              > >Jasmine (or whatever it is called this week) - an object oriented
              > >distributed data store
              > >....
              > >
              > >Peace,
              > >
              > >--
              > >Cameron Purdy
              > >Tangosol Inc.
              > ><< Tangosol Server: How Weblogic applications are customized >>
              > ><< Download now from http://www.tangosol.com/download.jsp >>
              > >
              > >
              > >"Devi" <[email protected]> wrote in message
              > >news:[email protected]...
              > >>
              > >> Our Application is mainly depends on Application scope objects. On
              > >one
              > >m/c, it
              > >> is perfect.
              > >> Now, we want to support the failover , load balancing ... (High
              > >Availability).
              > >>
              > >> I know, weblogic cluster supports HttpSessions, EjbObjects ... etc.
              > > What
              > >about
              > >> Application scope objects.
              > >> we are planning for weblogic server which supports the our requirements.
              > >>
              > >> If not, what is the solution to make it work by using Weblogic server.
              > >> for eg: I can give what type of application we are developing ---
              > >similar to
              > >> textchat.
              > >> our application is real time application.
              > >>
              > >
              > >
              

  • Application scope variables ... an easier way or not ?

    Instead of sharing application scope variables through the
              servletContext()/application I am using a normal singleton class (or maybe
              static class) to share all my application varaiable. It works fine and it
              takes a lot less code to write.
              It seamed logical to do this a static classes or singletons are shared
              within a single servletContext/application (which there seems to be only one
              per WL instance anyway). (singleton is quite nice pattern coz. all
              jsp:useBeans with the application scope are by definition singletons)
              Has anoyne tried something similar or maybe know of the problem with this
              approach. I assume that server will never reinitialise application level
              variables ...... hope the assumption is correct. ....
              

    When you specify application scope, the JSP stores/retrieves the value
              into/from the servlet context. You may already know this, but it sounded
              like what you thought you were somehow avoiding.
              Cameron Purdy
              http://www.tangosol.com
              "Bohinc D" <[email protected]> wrote in message
              news:[email protected]..
              > Instead of sharing application scope variables through the
              > servletContext()/application I am using a normal singleton class (or maybe
              > static class) to share all my application varaiable. It works fine and it
              > takes a lot less code to write.
              >
              > It seamed logical to do this a static classes or singletons are shared
              > within a single servletContext/application (which there seems to be only
              one
              > per WL instance anyway). (singleton is quite nice pattern coz. all
              > jsp:useBeans with the application scope are by definition singletons)
              >
              > Has anoyne tried something similar or maybe know of the problem with this
              > approach. I assume that server will never reinitialise application level
              > variables ...... hope the assumption is correct. ....
              >
              >
              >
              

  • 300 requests per hour reading from Application scope Good/Bad idea

    I am saving some html in application scope & reading with
    <cflock readonly.
    Will it be a problem if more than 5 requests are made per
    second?
    Does deadlocks occurs with readonly-cflock?
    Thanks

    While creating/changing application scope variables in a
    lock, I think there must be an exclusive lock. You must be careful
    not to set any shared variable such as application inside a read
    only cflock tag.
    I also would suggest to check the usage of Application.cfc
    and onApplicationStart method. You can set application default
    variables and constants in onApplicationStart method in your
    Application.cfc.

  • Best Performance? - having a single stateless java pojo as delegate- give it application scope?

    I'm curious about which is best from a performance standpoint -<br /><br />All of our flex calls access a single java pojo. In my remoting-config.xml I'm currently declaring the destination a property scope of 'application': <br /><br /><destination id="UIServicesDelegate"><br />    <channels><br />      <channel ref="my-amf"/><br />      <channel ref="my-local-amf"/ <br />    </channels> <br />     <properties><br />        <factory>spring</factory><br />        <source>uiServicesDelegateBean</source><br />        <scope>application</scope><br />    </properties><br /></destination><br /><br />All of the UIServiceDelegate methods are stateless however, so I'm wondering if I'm gaining anything by giving it scope session. Since their all stateless I"m assuming application scope would be the best from a performance standpoint? I'm assuming in this case only one object will ever be instantiated? <br /><br />Assuming it was between Session and Request scope, is there a lot of overhead instantiating the new server side object each time? I would assume performance would be better using the Session in this case, with the only draw back of some server-side ram being chewed up storing the object in the Session. <br /><br />If you want "singleton" type approach, I figure just using application scope is the preferred approach?

    You wont get any api for directly accessing Servlet application objects from any ejb. I dont think MDB either solves your problem directly. Indirectly you can place a request to some servlet (should be there for each JVM and web application ) and update your application scope variable. I would suggest you to cache the data in database if the size of cache is large. otherwise any open caching tools may help you.

  • A struct in the application scope will be lost / damaged

    Hello,
    we have a strange problem with our CFMX 7,0,2, perhaps
    somebody can help?
    In the application.cfm a xml-file will be loaded, parsed and
    saved as a struct in an application variable. This will take place
    only if the struct isn't defined. We set the application variable
    exclusive by cflock. After some times, the struct or an element of
    the struct will be lost. At this time, we get "Null Pointer
    Exceptions".
    java.lang.NullPointerException
    at coldfusion.xml.XmlNodeMap.size(XmlNodeMap.java:656)
    at coldfusion.runtime.Struct.StructCount(Struct.java:172)
    at coldfusion.runtime.CFPage.StructCount(CFPage.java:4133)
    Some questions:
    - Why is the struct / the elements in the application scope
    are lost? The application timeout is set to 2days, and other
    application variables aren't lost.
    - Why will cftry / cfcatch not work in this case?
    What can we do?
    Kind regards
    Karl-Heinz

    you can use the isDefined function in the onRequestStart
    function in Application.cfc
    I have never had an application scoped variable / object get
    lost or damaged in the way that you're describing.
    are you loading it in the onApplicationStart function of
    Application.cfc ? that would be a good place to do it.
    oh, actually, I did have a contractor who assigned the
    application name dynamically, I think the name contained the
    current date so each time the date would change the application
    would change - you might want to make sure that is not happening to
    you.

  • Initializing application scope beans on startup

    Hi All,
    I need to initialize an application scope managed bean on startup, and not have to wait for it to be referenced the first time.
    I was thinking of using ContextListener, but you dont have access to the faces context in the listener.
    And you cant even extend FacesServlet, since its final.
    Any ideas on how this can be achieved.
    Thanks for your help!!

    Try with FacesContext.getCurrentInstance() or http://www.jsffaq.com/Wiki.jsp?ptitle=How+to+access+FacesContext+from+the+Filter+or+Servlet%3F&page=HowToAccessFacesContextFromTheFilterOrServlet

  • Setting Beans in Application Scope

    How do I set beans in application scope at the start of a JSF web app? I'd like to be able to do something similar to the Struts plugin.

    Hi,
    I also tried to use a servletcontextlistener. The problem is, that I cannot
    put any beans in the facescontext, because a NullpointerExcpetion
    is thrown. In the contextInitialized-Method I do the following:
    FacesContext context = FacesContext.getCurrentInstance();
    ApplicationFactory factory =
         (ApplicationFactory) FactoryFinder.getFactory(
                   FactoryFinder.APPLICATION_FACTORY);
    Application application = factory.getApplication();
    ValueBinding binding = application.createValueBinding( "#{Bean}" );
    In the createValueBinding-method a Exception is thrown. So I cannot call
    createValueBinding when I am not in a facescontext.
    Can anyone help me?
    Thanks
    Andy

Maybe you are looking for

  • Mac Pro - Keeps crashing more frequently

    Hi All, I wonder if anyone can help as I keep having issues with my Mac Pro crashing more and more frequently. Its an early 2008 model 2 x 2.8ghz, 10gb ram, Nvidia 8800 GT512 card.  Im on mountain lion which is up to date. I'm a photographer and when

  • Why use RMAN CATALOG ?

    Hi, Anybody tell me why use RMAN CATALOG and what benifits if i have create catalog ?

  • Downloadable File for Acrobat 9 Standard

    I am trying to find Acrobat 9 Standard to be downloaded to a new computer.  I cannot find the download file.  I can only find Acrobat 9 Pro.  Where can I find a download version of Acrobat 9 Standard?

  • Session management in JAX-RCP with JWSDP 1.0_01

    Hi all, How can I access to the HTTP Session of the TOMCAT which run the Web Services engine? Browsing by the API I've found the method getHttpSession() in the interface javax.xmlrpc.server.ServletEndpointContext. How can get an instance which implem

  • IPhoto Library accidentally put in the trash

    My husband somehow accidentally put our iphoto library in the trash --don't ask, somehow it happened. The good news is that we haven't emptied the trash so the photos are still there, but I need to know where to move them. We had been getting this me