Session Managed Beans + Session Destory

Hey guys,
I have an simple question. How can I destroy an Session in JSF. For Example if I have an Manged Beans in scope Session:
        <managed-bean>
          <managed-bean-name>User</managed-bean-name>
          <managed-bean-class>example.user.User</managed-bean-class>
          <managed-bean-scope>session</managed-bean-scope>
     </managed-bean>          This would instance if an User successful logged in. But if the User logged out, I can set all attributes = Null; But the easier and better way is to destroy the Session. But how can I destory an Session Managed Bean?
Thanks for help

Yes, there's an easy way.
          //Reset current state of application (for the current user) by
          //invalidating the session
          HttpSession session = (HttpSession)FacesContext.getCurrentInstance().
               getExternalContext().getSession(false);
          if (session != null)
               session.invalidate();CowKing

Similar Messages

  • Session scope managed bean is not instantiating?

    We have the need to use a session bean (rather than pageFlowScope) in our application.  But it looks like the session beans are not being instantiated at run time like other beans are.  I created a simple test case to verify.  One bean, named "MySessionBean", defined in the task flow as Session scope, then referenced in a view with an input text box, value:  #{sessionScope.MySessionBean.value1}. When I run the application,  I just get PropertyNotFoundException, Target Unreachable, 'MySessionBean' returned null.
    If I simply change the bean to use pageFlowScope, everything works fine.   I have debug code in the bean constructor, and it never gets called.   Is there some other step I am missing to have ADF instantiate the session bean?

    No luck, I tried it in both adfc-config.xml, and faces-config.xml.  I also tried moving the call to my view, from my bounded taskflow, into the adfc-config unbounded task flow, and then I ran that instead.  Still got the same error.    Here is my code from the the last round of tests with the view called in the main adfc-config.xml unbounded taskflow:
    adfc-config.xml:
    <?xml version="1.0" encoding="windows-1252" ?>
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
          <view id="testView">
                <page>/testView.jspx</page>
          </view>
          <managed-bean id="__2">
          <managed-bean-name id="__5">MySessionBean</managed-bean-name>
          <managed-bean-class id="__4">test.MySessionBean</managed-bean-class>
          <managed-bean-scope id="__3">session</managed-bean-scope>
        </managed-bean>
    </adfc-config>
    testView.jspx:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1">
          <af:form id="f1">
            <af:inputText label="Label 1" id="it1"
                          value="#{sessionScope.MySessionBean.value1}"/>
          </af:form>
        </af:document>
      </f:view>
    </jsp:root>
    MySessionBean.java:
    package test;
    public class MySessionBean {
        private String value1="Hello World";
        public MySessionBean() {
            super();
        public void setValue1(String value1) {
            this.value1 = value1;
        public String getValue1() {
            return value1;

  • Reset JSF session and the managed beans with sesison scope

    Hi,
    this is a very general question and maybe stupid for most of you. I have my jsf/facelets web application and i use inside of this application some managed beans, which are session beans. I want to know how is it possible to reset this beans. I'm asking this question beacuse i have this kind of problem: i built my web application which has a login form and i use the browser to test it. When i browse to the login page and I login with my credentials i get my customized home page. Then i open another istance of the browser and i browse to the login page again but this time i login as a different user. The result home page is the same as i got before with my login credentials, so the session is always the same. Instead i want the session and all its objects to be resetted for the new user! Do youn know which is the solution?

    The fact is that i want to have two sessions in parallel, so using the same browser and opening two tabs, i want to browse to the login page and access as two totaly different users and using in parallel the application without the problem of one user's action affecting the other user beacuse of session sharing. So I want to force the application to create two different session for the two users logins, because as i told you before as it is now, they are sharing the same sesison. And i think that if i at the login time I iterate thorugh the session and delete all the objects i will be able to have only one session per time. Isn't it?

  • Share stateful session bean in JSF managed beans with different scope

    Hi,
    I have a JSF application and I want to try to use of stateful session beans.
    So I created a new stateful session bean and its local interface.
    @Stateful
    public class StatefulSessionBean implements StatefulSessionBeanLocalInterface{
    private String name;
    @Local
    public interface StatefulSessionBeanLocalInterface {
    ...In my JSF application I have a mananed bean with session context which registers the new interface by
    this annotation
    @EJB(name="sessionbeanref", beanInterface=StatefulSessionBeanLocalInterface.class) and set the name to something.
    Now I want to fetch this name in another managed bean with request scope. So I looked up the bean and tried to get the name.
    StatefulSessionBeanLocalInterface = (StatefulSessionBeanLocalInterface) new InitialContext().lookup("java:comp/env/sessionbeanref");
    System.out.println(currentmailingbean.getName());but the name is null.
    Why?

    The xsd was created via the netbeans J2EE enterprise application dialog and I think its the most recent.
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">All other annotations seem to work.
    Wouldnt the lookup completely fail if the deployment process thought that it is version 1.4 ?

  • Access session values in Managed Bean

    I want to acces session attribute values in my Managed Bean class.
    This is my code in SecurityPhaseListener.java class,
    HttpSession session = (HttpSession)facesContext.getCurrentInstance().getExternalContext().getSession(true);
    String isAuthorized = "false";
    session.setAttribute(isAuthorized, isAuthorized);
    This is my configuration for My managed bean in faces-config.xml class
    <managed-bean>
    <managed-bean-name>setNewDayBean</managed-bean-name>
    <managed-bean-class>com.hli.vipstar.uswm.setnewday.managedbean.SetNewDayBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    Now i want to access the attribute "isAuthorized" in my managed bean SetNewDayBean.java.
    How to do this?
    Any one help me...........

    The same way, but then using getAttribute() instead of setAttribute().
    Another -more clean- way is to use the ExternalContext#getSessionMap(). It will make your code independent from the session implementation used. You may find this article useful as well: http://balusc.blogspot.com/2006/06/communication-in-jsf.html

  • Af:table requires the managed bean to be in session scope?

    I have let to figure out why af:table requires the managed bean to be in session scope if the af:table has the rows attribute set to anything else but zero.
    I'm assuming that in order for the table to hold on and "page" through the range of records that it is a requirement...
    Any details on how the under-pinnings really works, would be appreciated.
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Todd,
    If you create a table model that you reference from an EL on the table's row variable then this should work with request scope as well. However, I think the problem you would run into is
    - performance because the values are getting fetched with every page load
    - state, because you would have to persist any change immediately to ensure the next query brings up the change values
    Frank

  • How invalidate a session managed bean

    I have a faces-config. xml file with the following content:
    <managed-bean>
    <managed-bean-name>pc_mybean</managed-bean-name>
    <managed-bean-class>mybean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    For some reasons I needed to put it as session.
    Now I would like to know if there is a way to invalidate the session bean. Does someone know? How can I access to the bean with my java code?
    Thanks a lot.
    Didi

    the method to invalidate the bean:
         public static void resetManagedBean(String beanName) {
              getValueBinding(getJsfEl(beanName)).setValue(FacesContext.getCurrentInstance(), null);
         private static ValueBinding getValueBinding(String el) {
              return getApplication().createValueBinding(el);
         public static String getJsfEl(String value) {
              return "#{" + value + "}";
         }

  • Problems integrating JSF managed bean with Session EJB with JDeveloper

    HI All,
    I am developeing a JSF-EJB application using Jdeveloper11g. On deploying the application I am getting the following errors on deployment.
    <19/08/2010 2:53:49 PM EST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1282193629318' for task '17'. Error is: 'weblogic.application.ModuleException: Could not setup environment'
    weblogic.application.ModuleException: Could not setup environment
         at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1499)
         at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:442)
         at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:375)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
         at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:95)
         Truncated. see log file for complete stacktrace
    Caused By: weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'MetaDataBean' declared in the ejb-ref or ejb-local-ref 'MetaData' in the application module 'ViewControllerWebApp.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.
         at weblogic.deployment.BaseEnvironmentBuilder.addEJBLinkRef(BaseEnvironmentBuilder.java:453)
         at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:485)
         at weblogic.servlet.internal.CompEnv.activate(CompEnv.java:157)
         at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:3117)
         at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1497)
         Truncated. see log file for complete stacktrace
    >
    <19/08/2010 2:53:49 PM EST> <Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 1 task for the application 'data-catalog'.>
    <19/08/2010 2:53:49 PM EST> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'data-catalog'.>
    <19/08/2010 2:53:49 PM EST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
    weblogic.application.ModuleException: Could not setup environment
         at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1499)
         at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:442)
         at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:375)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
         at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:95)
         Truncated. see log file for complete stacktrace
    Caused By: weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'MetaDataBean' declared in the ejb-ref or ejb-local-ref 'MetaData' in the application module 'ViewControllerWebApp.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.
         at weblogic.deployment.BaseEnvironmentBuilder.addEJBLinkRef(BaseEnvironmentBuilder.java:453)
         at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:485)
         at weblogic.servlet.internal.CompEnv.activate(CompEnv.java:157)
         at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:3117)
         at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1497)
         Truncated. see log file for complete stacktrace
    Thanks
    Edited by: user5108636 on 18/08/2010 22:46

    Please find attached the source code of JSF managed bean, local business interface, session bean and web.xml
    MANAGED BEAN_
    package view.backing;
    import java.util.List;
    import javax.ejb.EJB;
    import javax.faces.component.UISelectItems;
    import javax.faces.component.html.HtmlSelectManyListbox;
    import model.ejb.session.MetaDataBean;
    public class SearchMetaDataBean {
    @EJB MetaDataBean metaDataService;
    private List<String> tables;
    private List<String> columns;
    private HtmlSelectManyListbox selectManyListbox1;
    private UISelectItems selectItems1;
    public void setTables(List<String> tables) {
    this.tables = tables;
    public List<String> getTables() {
    return metaDataService.getTables();
    public void setColumns(List<String> columns) {
    this.columns = columns;
    public List<String> getColumns() {
    return columns;
    public void setSelectManyListbox1(HtmlSelectManyListbox selectManyListbox1) {
    this.selectManyListbox1 = selectManyListbox1;
    public HtmlSelectManyListbox getSelectManyListbox1() {
    return selectManyListbox1;
    public void setSelectItems1(UISelectItems selectItems1) {
    this.selectItems1 = selectItems1;
    public UISelectItems getSelectItems1() {
    return selectItems1;
    LOCAL INTERFACE_
    package model.ejb.session;
    import java.util.List;
    import javax.ejb.Local;
    @Local
    public interface MetaDataLocal {
    public List<String> getTables();
    public List<String> getColumns(String tableName);
    SESSION BEAN_
    package model.ejb.session;
    import javax.ejb.Local;
    import java.sql.Connection;
    import java.sql.DatabaseMetaData;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.ArrayList;
    import java.util.List;
    import javax.annotation.PostConstruct;
    import javax.annotation.Resource;
    import javax.ejb.Stateless;
    import javax.sql.DataSource;
    @Stateless(name="MetaData")
    @Local
    public class MetaDataBean implements MetaDataLocal{
    @Resource(name="jdbc/DWDS")
    private DataSource dataSource;
    private Connection connection;
    private List<String> tables = new ArrayList<String>();
    private List<String> columns = new ArrayList<String>();
    private DatabaseMetaData dmd;
    @PostConstruct
    public void initialize(){
    try{
    connection = dataSource.getConnection();
    DatabaseMetaData dmd;
    dmd = connection.getMetaData();
    }catch(SQLException sqle){
    sqle.printStackTrace();
    public MetaDataBean() {
    public List<String> getTables(){
    try{                 
    if (dmd ==null){
    //System.out.println("Database meta data not available");
    tables.add("None");
    }else{
    ResultSet rs = dmd.getSchemas();
    ResultSet rs1 = null;
    while(rs.next()) {
    if (rs.getString(1).equalsIgnoreCase("AV_DATA")){
    rs1 = dmd.getTables(null,rs.getString(1),"%",null);
    while(rs1.next()) {
    tables.add(rs1.getString(3));
    }catch (SQLException sqle){
    sqle.printStackTrace();
    return tables;
    public List<String> getColumns(String tableName){
    try{
    ResultSet rsColumns = dmd.getColumns("", "AV_DATA", tableName, null);
    while(rsColumns.next()){
    columns.add(rsColumns.getString(4));
    }catch (SQLException sqle){
    sqle.printStackTrace();
    return columns;
    WEB.XML_
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <ejb-local-ref>
    <ejb-ref-name>MetaData</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local>model.ejb.session.MetaDataLocal</local>
    <ejb-link>MetaDataBean</ejb-link>
    </ejb-local-ref>
    </web-app>
    Edited by: user5108636 on 18/08/2010 22:45
    Edited by: user5108636 on 18/08/2010 22:46

  • Keeping session using custom save button in managed bean

    Greetings,
    I'm building a application based on BC + ADF(JSF).
    All around the app. I need two buttons, one for committing and actualizing the UI data, and other to return to the previous page.
    Instead of customizing those buttons every time they occurs, I've haded a managed bean to do the work. This managed bean as "request" scope.
    The process of editing a form, requires me to have one form to only view the data and other to edit the data.
    The issue is: when saving a form, it should return ("back" action) to his precedence, keeping the session state.
    That is: If I'm editing "process 2" when i commit it should go to "process 2" in read only mode.
    This works fine if i use "hardcoded buttons", but when i use the managed bean to handle those buttons action, when committing, it goes to the first on the list. It doesen't keep the session state.
    How can i keep the state ?
    Thanks
    here it is the managed bean:
    package fc.view.backing;
    import fc.model.FirstCareAppModuleImpl;
    import javax.faces.context.FacesContext;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.adf.view.faces.component.core.nav.CoreCommandButton;
    import oracle.binding.BindingContainer;
    import oracle.binding.OperationBinding;
    import oracle.jbo.ViewObject;
    public class fcLib {
    private BindingContainer bindings;
    private CoreCommandButton commandButton_save;
    private CoreCommandButton commandButton_backOnePage;
    private CoreCommandButton commandButton_backHome;
    * Get and set bindings
    public BindingContainer getBindings() {
    return this.bindings;
    public void setBindings(BindingContainer bindings) {
    this.bindings = bindings;
    * Getters ans setters for "save" and "back" buttons
    public void setCommandButton_save(CoreCommandButton commandButton_save) {
    this.commandButton_save = commandButton_save;
    public CoreCommandButton getCommandButton_save() {
    return commandButton_save;
    public void setCommandButton_backOnePage(CoreCommandButton btn) {
    this.commandButton_backOnePage = btn;
    public CoreCommandButton getCommandButton_backOnePage() {
    return commandButton_backOnePage;
    public void setCommandButton_backHome(CoreCommandButton btn) {
    this.commandButton_backHome = btn;
    public CoreCommandButton getCommandButton_backHome() {
    return commandButton_backHome;
    * Back actions for back buttons
    public String commandButton_backOnePage_action() {
    return "back";
    public String commandButton_backHome_action() {
    return "home";
    * Save button action - Used in al pages that do save (commit) data
    public String commandButton_save_action() {
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("Commit");
    OperationBinding operationBinding2 = bindings.getOperationBinding("Execute");
    operationBinding.execute();
    operationBinding2.execute();
    // It should be a error page
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    // Refresh main view object
    DCBindingContainer bc = (DCBindingContainer)FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get("bindings");
    FirstCareAppModuleImpl fc = (FirstCareAppModuleImpl)bc.findDataControl("FirstCareAppModuleDataControl").getDataProvider();
    ViewObject vo_SitSocProf = fc.findViewObject("EpisodiosMain");
    vo_SitSocProf.executeQuery();
    System.out.println(" All done. Ciao ");
    return "back";
    }

    Hi
    I re-execute the query only to refresh the AM VO data.
    I'm using AM EO to access DB Views, that use IOF triggers to update/insert/delete into the DB.
    Using the application, when updating data, changes wont reflect in the UI if I don't refresh the "master" VO, that is "EpisodiosMain". I'm doing a commit and a execute to a "detail" VO.
    "If you need to execute the query and set it back to the last row you worked with, get the row key before executing the query so you can set the current row back to this rowkey"
    Could you please throw a example on how to do this ?
    "Reaching through to the AM to execute the VO isn't best practices. You should grap the associated iterator in teh binding instead and perform the execute operation. Note that usig ADF binding there are only rare situations in which you need to access teh business service directly as you do. "
    Again, could you please post an example of how to do this, or introduce me to some documentation.
    Thanks
    Message was edited by:
    Buondi

  • Initialize managed bean from request parameters

    Hi:
    I thought this topic would be on the FAQ, but I couldn't find it. I am looking for a mean to initialize my managed bean from the query string. There must be something like:
    <h:form initializeBean=""true"" requestParameter=""id_author"" beanProperty=""#{author.id_author}"" action=""#{author.getFromDB}"" >
    </form>
    The url would be something like http://localhost:8080/protoJSF/showAuthor.jsf?id_author=5334
    And the getFromDB method would be something like
      Public void getFromDB()
         Statement stmt = cn.createStatement( ?SELECT * from author where id_author=? + getId_author() );
         ResultSet rs = stmt.executeQuery();
      }The only way I've found to perform something like this is to present a blank author form with a ''load data'' button: after pressing the button the user can see author's data and edit the data if she wants to. This two-step data screening is annoying, to say the least.
    There must be a better way.
    I beg for a pointer on how can I achieve the initializing of a managed bean with dynamic data.
    Regards
    Alberto Gaona

    You just have to read carefully the very fun 289 pages
    specification :-)Or, if 289 pages of JavaServer Faces is too much, you can get almost all of the same information from the JavaServer Pages 2.0 specification, or even the JSP Standard Tag Libraries specification :-).
    More seriously, the standard set of "magic" variable names that JavaServer Faces recognizes is the same as that reognized by the EL implementations in JSP and JSTL. Specifically:
    * applicationScope - Map of servlet context attributes
    * cooke - Map of cookies in this request
    * facesContext - The FacesContext instance for this request
    * header - Map of HTTP headers (max one value per header name)
    * headerValues - Map of HTTP headers (String array of values per header name)
    * initParam - Map of context initialization parameters for this webapp
    * param - Map of request parameters (max one value per parameter name)
    * paramMap - Map of request parameters (String array of values per parameter name)
    * requestScope - Map of request attributes for this request
    * sessionScope - Map of session attributes for this request
    * view - The UIViewRoot component at the base of the component tree for this view
    If you use a simple name other than the ones on this list, JavaServer Faces will search through request attributes, session attributes, and servlet context (application) attributes. If not found, it will then try to use the managed bean facility to create and configure an appropriate bean, and give it back to you.
    For extra fun, you can even create your own VariableResolver that can define additional "magic" variable names known to your application, and delegate to the standard VariableResolver for anything else.
    Craig McClanahan

  • How do I use a managed bean in another managed bean

    I have two managed beans. One is backing bean for a form and the other is used to access a database table.
    1st bean
    public class TestDBAO
    @PersistenceContext
    private EntityManager em;
    public void addEntry(PersonObj person)
    em.persist(person);
    public class formdata
    private String id;
    private String fname;
    private String lname;
    getter functions
    setter functions
    public String submit()
    in here i want to call addEntry function from TestDBAO
    How can I achieve this or is there another way to do this?

    Do I understand correctly that you have definied TestDBAO as a session scoped managed bean? Why?
    You don't need that. Just create and call TestDBAO in the backing bean. Or if you want only one instance of TestDBAO during the session, then create a singleton constructor and eventually make the methods static.

  • Action / actionListener in h:commandButton with managed beans

    I have a problem with a backing bean whose method is not invoked when i click it. I've seen some posts on here about this yet, I still don't understand what I am doing wrong, if anything.
    Some context...I've modeled my application after 'jcatalog' from this article:
    http://www.javaworld.com/javaworld/jw-07-2004/jw-0719-jsf.html . It's simpler than the article -- I'm not using Spring/Hibernate and the persistence is the file system. For each business object (Resource), there's a backing bean (ResourceBean).
    In short, I can't get the backing bean to respond to the button event for 'Add' bound to addAction. This is just like the jcatalog 'createProduct' impl -- which doesn't use the (FacesEvent fe ) approach.
    Anyway, I would appreciate anyone's help to get past this.
    -Lorinda
    (Below are the codes...)
    Here's my beans-config.xml:
         <!-- view -->
         <managed-bean>
              <description>
                   Managed bean that is used as an application scope cache
              </description>
              <managed-bean-name>applicationBean</managed-bean-name>
              <managed-bean-class>
                   com.intalio.qa.tcm.view.beans.ApplicationBean
              </managed-bean-class>
              <managed-bean-scope>application</managed-bean-scope>
              <managed-property>
                   <property-name>viewServicesManager</property-name>
                   <value>#{viewServicesManagerBean}</value>
              </managed-property>
              </managed-bean>
         <managed-bean>
              <description>
                   View service manager impl for business services
              </description>
              <managed-bean-name>viewServicesManagerBean</managed-bean-name>
              <managed-bean-class>
                   com.intalio.qa.tcm.view.beans.ViewServicesManagerBean
              </managed-bean-class>
              <managed-bean-scope>application</managed-bean-scope>
         </managed-bean>
         <managed-bean>
              <description>
                   Backing bean that contains product information.
              </description>
              <managed-bean-name>resourceBean</managed-bean-name>
              <managed-bean-class>
                   com.intalio.qa.tcm.view.beans.ResourceBean
              </managed-bean-class>
              <managed-bean-scope>session</managed-bean-scope>
         </managed-bean>
    (Note, the applicationBean uses view services manager. The manager is used by the ResourceBean. (It's initialized by the h:output dummy variable reference at the top of my .jsp page)). I can see the initialization in the debug trace.
    Here's the resource bean:
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.FacesException;
    import javax.faces.model.SelectItem;
    import com.intalio.qa.exceptions.DuplicateIdException;
    import com.intalio.qa.exceptions.TCMException;
    import com.intalio.qa.tcm.model.Resource;
    import com.intalio.qa.tcm.view.builders.ResourceBuilder;
    import com.intalio.qa.tcm.view.util.FacesUtils;
    * Resource backing bean.
    public class ResourceBean extends RootBean {
    * The Resource id
         private String id;
         * The Resource name
         private String name;
    * Description
    private String description;
         * the resource type id associated with the Resource
         private String resourceTypeId;
    // the resource type id associated with the Resource
    private List resourceTypeIds;
    * @return Returns the resourceTypeIds.
    public List getResourceTypeIds() {
    return resourceTypeIds;
    * @param resourceTypeIds The resourceTypeIds to set.
    public void setResourceTypeIds(List resourceTypeIds) {
    this.resourceTypeIds = resourceTypeIds;
         * Default constructor.
         public ResourceBean() {
    super();
    init();
         * Initializes ResourceBean.
         * @see RootBean#init()
         protected void init() {
              try {
                   LOG.info("ResourceBean init()");
                   if (id != null) {
                        Resource resource = viewServicesManager.getResourceService().getResourceById(id);
                        ResourceBuilder.populateResourceBean(this, resource);
              } catch (TCMException ce) {
                   String msg = "Could not retrieve Resource with id of " + id;
                   LOG.info(msg, ce);
                   throw new FacesException(msg, ce);
         * Backing bean action to update Resource.
         * @return the navigation result
         public String updateAction() {
              LOG.info("updateAction is invoked");
              try {
         //          Resource Resource = ResourceBuilder.createResource(this);
              //     LOG.info("ResourceId = " + Resource.getId());
              //     viewServicesManager.getResourceService().updateResource(Resource);
                   //remove the ResourceList inside the cache
                   //FacesUtils.resetManagedBean(BeanNames.RESOURCE_LIST_BEAN);
              } catch (Exception e) {
                   String msg = "Could not update Resource";
                   LOG.error(msg, e);
                   FacesUtils.addErrorMessage(msg + ": Internal Error.");
                   return NavigationResults.FAILURE;
              LOG.info("Resource with id of " + id + " was updated successfully.");
              return NavigationResults.SUCCESS;
         * Backing bean action to create a new Resource.
         * @return the navigation result
         public String addAction() {
              LOG.info("addAction is invoked");
              try {
                   Resource resource = ResourceBuilder.createResource(this);
    LOG.info("between");
                   viewServicesManager.getResourceService().saveResource(resource);
              } catch (DuplicateIdException de) {
                   String msg = "This id already exists";
                   LOG.info(msg);
                   FacesUtils.addErrorMessage(msg);
                   return NavigationResults.RETRY;
              } catch (Exception e) {
                   String msg = "Could not save Resource";
                   LOG.error(msg, e);
                   FacesUtils.addErrorMessage(msg + ": Internal Error");
                   return NavigationResults.FAILURE;
              String msg = "Resource with id of " + id + " was created successfully.";
              LOG.info(msg);
              return NavigationResults.SUCCESS;
         * Backing bean action to delete Resource.
         * @return the navigation result
         public String deleteAction() {
              LOG.info("deleteAction is invoked");
              try {
         //          Resource Resource = ResourceBuilder.createResource(this);
         //          viewServicesManager.getResourceService().deleteResource(Resource);
                   //remove the ResourceList inside the cache
    //               FacesUtils.resetManagedBean(BeanNames.RESOURCE_LIST_BEAN);
              } catch (Exception e) {
                   String msg = "Could not delete Resource. ";
                   LOG.error(msg, e);
                   FacesUtils.addErrorMessage(null, msg + "Internal Error.");
                   return NavigationResults.FAILURE;
              String msg = "Resource with id of " + id + " was deleted successfully.";
              LOG.info(msg);
              FacesUtils.addInfoMessage(msg);
              return NavigationResults.SUCCESS;
         public String getId() {
              return id;
         * Invoked by the JSF managed bean facility.
         * <p>
         * The id is from the request parameter.
         * If the id is not null, by using the id as the key,
         * the Resource bean is initialized.
         * @param newQueryId the query id from request parameter
         public void setId(String newId) {
              id = newId;
         public String getName() {
              return name;
         public void setName(String newName) {
              name = newName;
         public String getDescription() {
              return description;
         public void setDescription(String newDescription) {
              description = newDescription;
         public String getResourceTypeId() {
              return resourceTypeId;
         public void setResourceTypeId(String newResourceTypeId) {
              resourceTypeId = newResourceTypeId;
         public String toString() {
              return "id=" + id + " name=" + name;
    Here's the jsp:
    <f:subview id="resourcesCombinedView_subview">
         <h:form id="createResourceForm" target="dataFrame">
              <h:outputText value="#{applicationBean.dummyVariable}" rendered="true" />
              <div align="center">
              <head>
              <link href="../../css/stylesheet.css" rel="stylesheet" type="text/css">
              <FONT color="#191970" size="4" face="Arial">Resources View</FONT>
              </head>
              <table style="margin-top: 2%" width="35%" cellpadding="10">
              <div align="left">
              <FONT color="#191970" size="3" face="Arial">Update Resources </FONT>
              </div>
                   <tr>
                        <td align="center" valign="top" align="center" style="" bgcolor="white" />
                        <table>
                             <tbody>
                                  <tr>
                                       <td align="left" styleClass="header" width="100" />
                                       <td align="left" width="450"/>
                                  </tr>
                                  <tr>
                                       <td align="right" width="100"><h:outputText value="Id" /></td>
                                       <td align="left" width="450"><h:inputText
                                            value="#{resourceBean.id}" id="id" required="true" /> <h:message
                                            for="id" styleClass="errorMessage" /></td>
                                  </tr>
                                  <tr>
                                       <td align="right" width="100"><h:outputText value="Name" /></td>
                                       <td align="left" width="450"><h:inputText
                                            value="#{resourceBean.name}" id="name" required="true" /> <h:message
                                            for="name" styleClass="errorMessage" /></td>
                                  </tr>
                                  <tr>
                                       <td align="right" width="100" valign="bottom"><h:outputText
                                            value="Type" /></td>
                                       <td align="left" width="550">
                                       <h:selectOneMenu
                                            value="#{resourceBean.resourceTypeId}" id="resourceTypeId">
                                            <f:selectItem itemValue="" itemLabel="Select Resource Type" />
                                            <f:selectItem itemValue="database" itemLabel="Database" />
                                            <f:selectItem itemValue="external application"
                                                 itemLabel="External Application" />
                                            <f:selectItem itemValue="internal"
                                                 itemLabel="Intalio|n3 Products" />
                                            <f:selectItem itemValue="os" itemLabel="Operating System" />
                                       </h:selectOneMenu> <h:outputText
                                            value="#{resourceBean.resourceTypeId}" /> <h:message
                                            for="resourceTypeId" styleClass="errorMessage" /></td>
                                  </tr>
                                  <tr>
                                       <td align="right" width="100" valign="bottom"><h:outputText
                                            value="Description" /></td>
                                       <td align="left" width="450"><h:inputText
                                            value="#{resourceBean.description}" id="description" size="96" />
                                       <h:message for="description" styleClass="errorMessage" /></td>
                                  </tr>
                             </tbody>
                        </table>
                        </h:form></td>
                        <!-- END DATA FORM -->
                        <!-- BEGIN COMMANDS -->
                        <td width="30%" align="left" valign="top"><h:form
                             id="buttonCommandsForm">
                             <h:panelGroup id="buttons">
                                  <h:panelGrid columns="1" cellspacing="1" cellpadding="2"
                                       border="0" bgcolor="white">
                                       <h:commandButton value="Add"
                                            style="height:21px; width:51px;font-size:8pt; font-color: black;"
                                            actionListener="#{resourceBean.addAction}">
                                       </h:commandButton>
                                       <h:commandButton id="deleteCB" value="Delete"
                                            style="height:21px; width:51px;font-size:8pt"
                                            action="#{resourceBean.deleteAction}">
                                       </h:commandButton>
                                       <h:commandButton id="spaceFillerButton" tabindex="-1"
                                            style="height:21px; width:51px;font-size:8pt;background-color: #ffffff;color: #ffffff;border: 0px;">
                                       </h:commandButton>
                                       <h:commandButton id="saveCB" value="Save"
                                            style="height:21px; width:51px;font-size:8pt"
                                            actionListener="#{resourceBean.saveAction}">
                                       </h:commandButton>
                                       <h:commandButton id="updateCB" value="Update"
                                            style="height:21px; width:51px;font-size:8pt"
                                            actionListener="#{resourceBean.updateAction}">
                                       </h:commandButton>
                                  </h:panelGrid>
                             </h:panelGroup>
                        </h:form> <!-- end buttons --></td>
                   </tr>
              </table>
              <HR align="center" size="2" width="60%" />
              <!-- data table --></div>
    </f:subview>

    Hey, anyway, have you note your jsp reference to the backing bean begins with a lowercase letter, and your backing bean class name begins with an uppercase letter?? I think that's it... I think, cause I'm too unexperienced in JSF.... Bye!!

  • Managed bean returns null on SetActionListener

    Hi,
    I'm trying to implement a filter for my table (something similar to what's done in the "OracleAS 10g R3: Oracle ADF for Forms/4GL Developers/Volume II" student guide, practice 9-5). The idea is to have a request-scoped managed bean which holds the filter value - the value is set using a SetActionListener, and later bound to a bind variable in a view with a view criteria. I have problem re-creating this in Trinidad (JDev 11 TP3, to be exact).
    I have created a request-scoped bean in adfc-config.xml (called 'ecnStatusBean'), with a managed property (named 'Status'). I am referencing it from my SetActionListener: setting #{'E'} to #{requestScope.ecnStatusBean.Status}. The reference compiles fine in the Expression Builder (it didn't before I created the managed bean), but when running and clicking the CommandLink with the SetActionListener, I get a runtime error:
    oracle.security.jazn.JAZNRuntimeException: Target Unreachable, 'ecnStatusBean' returned null
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:480)
    To make things more interesting, I tried changing the scope to session, and got a different error:
    oracle.adf.controller.ControllerException: ADFC-10001: Cannot instantiate class 'pelephone.cdma_ecn.ecn_manager.model.ecnStatusMB'.
         at oracle.adfinternal.controller.util.Utils.createAndLogFacesException(Utils.java:169)
    Am I doing a rookie's mistake? Is this a Trinidad issue? Something else?
    Thanks in advance for any help,
    Boris

    Are you sure about the reference you use here: #{requestScope.ecnStatusBean.Status}.
    Here is a simple sample of what works for me:
    The first page has this:
          <af:form binding="#{backing_start.form1}" id="form1">
            <af:inputText label="Label 1" binding="#{backing_start.inputText1}"
                          id="inputText1"/>
            <af:commandButton text="commandButton 1"
                              binding="#{backing_start.commandButton1}"
                              id="commandButton1" action="go">
              <af:setActionListener from="#{backing_start.inputText1.value}"
                                    to="#{backing_start.paramToPass}"/>
            </af:commandButton>
          </af:form>It references a bean that has this:
        private RichInputText inputText1;
        public void setInputText1(RichInputText inputText1) {
            this.inputText1 = inputText1;
        public RichInputText getInputText1() {
            return inputText1;
        public String paramToPass;
        public void setParamToPass(String paramToPass) {
            this.paramToPass = paramToPass;
        public String getParamToPass() {
            return paramToPass;
        }And then I can see it in the next page that I navigated to like this:
            <af:outputText value="the current value is #{backing_start.paramToPass}"/>In the adf-config.xml I have this:
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
      <view id="start">
        <page>/start.jspx</page>
      </view>
      <view id="end">
        <page>/end.jspx</page>
      </view>
      <control-flow-rule>
        <from-activity-id>start</from-activity-id>
        <control-flow-case>
          <from-outcome>go</from-outcome>
          <to-activity-id>end</to-activity-id>
        </control-flow-case>
      </control-flow-rule>
      <managed-bean>
        <managed-bean-name>backing_start</managed-bean-name>
        <managed-bean-class>backing.backing_start</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>
    </adfc-config>

  • Disabling a checkbox which is in a table, from managed bean

    disabling a checkbox which is in a table, from managed bean -
    i am able to iterate table and get/set value of checkbox but i want to disable it, how can i do that?
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application app = facesContext.getApplication();
    ExpressionFactory elFactory = app.getExpressionFactory();
    ELContext elContext = facesContext.getELContext();
    ValueExpression valueExp = elFactory.createValueExpression(elContext, "#{bindings}", Object.class);
    DCBindingContainer bindings = (DCBindingContainer) valueExp.getValue(elContext);
    DCIteratorBinding iter = bindings.findIteratorBinding("dogsIterator");
    RowSetIterator rit = iter.getRowSetIterator();
    rit.reset();
    while(rit.hasNext()) {
    Row currentRow = rit.next();
    Attribute attr = (Attribute)row.getAttribute("checked");
    what code should come here to disable checkbox?
    rit.closeRowSetIterator();
    thanks.

    Wes Fang wrote:
    You might find it easier to simply use EL and evaluate that value on the disable property:
    <af:column ...>
    <af:selectBooleanCheckbox ... disabled="#{row.bindings.checked.inputValue==YOUR_DISABLE_VALUE?true:false}"/>
    </af:column>
    i used this approach.
    kept a bean in session and used it's property in disabled attribute - now setting this property in my bean...

  • Get the current value of a managed bean.

    Hi guys
    I have a register page which takes the Login ID and the password and retype password whose values are stored in the "Managed Beans" in registerServer.java.
    I have a (PwdValidator.java) Custom validator for Re-type Password which validates itself against the password.
    Now my problem is from the PwdValidator.java how can I access the value of the password which is stored in the managed bean in registerServer.java.
    here is a copy of my faces-config.xml
         <managed-bean>
              <managed-bean-name>registerServer</managed-bean-name>
              <managed-bean-class>com.sun.registerServer</managed-bean-class>
              <managed-bean-scope>session</managed-bean-scope>
         </managed-bean>
    Help is really appreciated,
    Thanks,
    Chaprasi Baba

    Thanks for the reply but my question is how do I get
    the password value from the managed bean
    FacesContext context =
    FacesContext.getCurrentInstance();
    Application application = context.getApplication();
    CountryValueObject registerServer =
    (CountryValueObject)application.getVariableResolver().r
    solveVariable(context, "registerServer");
    String pwd = registerServer.password // So will this
    give me the current value for that session.You didn't go far enough in replacing the example code . Try this:
    FacesContext context = FacesContext.getCurrentInstance();
    Application application = context.getApplication();
    RegisterServer registerServer = (RegisterServer)application.getVariableResolver().resolveVariable(context, "registerServer");
    String pwd = registerServer.password // So will this give me the current value for that session.

Maybe you are looking for

  • Error in ws_download to excel

    Hi every one, I am in support project . I am having one requirement to download data to excel file. the program is running fine but the thing is when the data is downloaded to excel file the formulas are  appering in it.. but in program there is no s

  • Drag and drop examples do not work ?!

    Hi guys, i want to add drag and drop functionality to one of my programs i tried to run the java examples of this page: http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.html but it just does not work ! windows give me the "can't drop" icon w

  • Using an object in distributed env

    Hi, We developed an IMAP based application in single server JBOSS env. we are using a hashmap to store some information which shall be used by all the users of the application. Now we have to convert the application to distributed JBOSS (on different

  • Footer in FBL3N and FS10N reports

    Hi there. Is there a possibility to add a footer to reports printed from  mentioned transactions? Greetings. P.

  • Clearing receivable items by batch input

    HI all, in account receivable scenario my question concerns automatically clearing items (program RFEBBU00 create a batch input session) by using reference field instead of document number. I am not able to do it by customizing. Can you help me? Rega