Reset Managed Bean in Action Servlet?

I've searched through the forum and have came close in finding the answer however the recommended solution is not working...
How can I use this code:
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove("beanName");to reset a managed bean in an Action Servlet?
How can I get the managed bean in the Action Servlet and reset it?
I'm not after getting the HttpSession and invalidating it. I would just like to reset the managed bean in the servlet.
Thanks!

@RaymondDeCampo, Does resetting the managed
bean same with resetting the session?If you remove the bean from the session, using traditional servlet APIs, it will appear to JSF as an uninitialized managed bean. When the application uses it next, JSF will instantiate it and set the properties as normal.

Similar Messages

  • Access managed beans in action methods

    Hi,
    I am a newbie in JSF. In my first page, I am getting input from the user and pass it to my business object for processing. My Business Object returns some results and i want to show it in page 2 which has a different backing bean. So I am accessing the bean as follows:
    FacesContext Ctx = FacesContext.getCurrentInstance();
    Map Params = Ctx.getExternalContext().getSessionMap();
    ResultBean rbean = Params.get("MyResultBean");MyResultBean is registered to have session scope in my faces-config file and is the backing-bean for my page 2.
    Then i set the results in rbean and forward to the page 2.
    Is this the right way of doing? Or are there any other way of doing it?
    Need your valuable suggestions.
    - Mani

    This article might be useful: http://balusc.xs4all.nl/srv/dev-jep-com.html
    By the way, why are you using capitalized variabe names? It makes them unreadable .. I am referring to Ctx and Params.
    This is Java, not C# or so ;)

  • Validation, Task Flow, Servlet, Pop-up, and a Managed Bean

    Hi,
    We're trying to display a PDF in a pop-up by calling a Servlet within a JSF page by using a task flow in JDeveloper 11g R2.
    The relevant JSF snippet:
    <af:inlineFrame id="if1" shortDesc="Report" source="/pdfservlet" styleClass="AFStretchWidth"></af:inlineFrame>The /pdfservlet points to a Servlet with a doGet method as follows:
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      response.reset();
      OutputStream out = response.getOutputStream();
      FacesContext context = this.getFacesContext(request, response);
      OracleReportBean bean =
        context.getApplication().evaluateExpressionGet(context, "#{reportBean}", OracleReportBean.class);
      bean.run(context, out);
      removeFacesContext();
      out.close();
    }The Servlet attempts to get the FacesContext, but we've encountered the following exception:
    Caused By: javax.faces.FacesException: Cant instantiate class: oracle.adfinternal.view.faces.component.AdfViewRoot.We removed the following lines from the getFacesContext() method:
    UIViewRoot view = facesContext.getApplication().getViewHandler().createView(facesContext, "");
    facesContext.setViewRoot(view);This avoids the exception above, however... We're trying to get the parameters from the form that was submitted. Here is an example element from the form:
    <h:inputHidden value="MyMedicationList_Report" id="system_REPORT_RESOURCE"/>When the Servlet calls the Managed Bean to retrieve the value, it uses:
    Map<String, String[]> requestParameters = getRequestParameters();
    Parameters p = getParameters();
    for( String key : requestParameters.keySet() ) {
      for( String value : requestParameters.get( key ) ) {
        int i = key.indexOf( ':' );
        if( i >= 0 ) {
          key = key.substring( i + 1 );
        p.put( key, value );
    }Where getRequestParameters() attempts to get the external context to retrieve the request parameter values map:
    return getExternalContext().getRequestParameterValuesMap();The map comes up empty.
    I've tried following http://www.oracle.com/technetwork/developer-tools/adf/learnmore/oct2010-otn-harvest-183714.pdf by setting the web.xml to:
      <!-- JspFilter must be configured before adfBindings. -->
      <filter-mapping>
        <filter-name>JpsFilter</filter-name>
        <servlet-name>PDFServlet</servlet-name>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
        <dispatcher>REQUEST</dispatcher>
      </filter-mapping>
      <filter-mapping>
        <filter-name>adfBindings</filter-name>
        <servlet-name>PDFServlet</servlet-name>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
      </filter-mapping>And set the data bindings to:
      <pageMap>
        <page path="/pdfservlet" usageId="ca_bcpra_promis_reporting_view_PDFServletPageDef"/>
      </pageMap>
      <pageDefinitionUsages>
        <page id="ca_bcpra_promis_reporting_view_PDFServletPageDef" path="ca.bcpra.promis.reporting.view.PDFServletPageDef"/>
      </pageDefinitionUsages>The Servlet executes, calls the instantiated managed bean, but cannot read the request parameters.
    The button used to launch the task flow in a dialog is:
    <af:commandButton text="Run Report" id="submitReport" useWindow="true"
                      windowEmbedStyle="inlineDocument" windowModalityType="applicationModal" windowHeight="500"
                      windowWidth="700" action="runReport"/>By using a task flow, the user inputs are validated before the pop-up is opened. We want to keep that behaviour. The PDF opens and then returns with a NullPointerException:
    http://pastebin.com/raw.php?i=PaM64jL4
    The Servlet, through the managed bean, makes a request to the report server to pass parameters and generate a PDF. The PDF is streamed back to the browser via the Servlet.
    What other approaches can we take to:
    1. Send user and system parameters.
    2. Generate a PDF on a remote server.
    3. Stream the PDF back to the user in a pop-up.
    Thank you.

    It is not a static PDF. The PDF is generated, dynamically, on the report server using the parameters from multiple forms on the page.
    We've leveraged the HttpSession getSessionMap() object for now. When combined with a Method Task Flow, we can transfer the data (and FacesContext) to the report Servlet. For example, the following code exposes objects that the Servlet needs through the session:
      public void initReport(String reportName) {
        FacesContext context = FacesContext.getCurrentInstance();
        ExternalContext ec = context.getExternalContext();
        OracleReportBean bean =
          context.getApplication().evaluateExpressionGet(context, "#{reportBean}", OracleReportBean.class);
        bean.setFacesContext(context);
        ec.getSessionMap().put("reportBean", bean);
        ec.getSessionMap().put(Parameters.PARAM_REPORT_RESOURCE, reportName);
      }This means the Servlet can use the object:
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.reset();
        // Find the bean from the session.
        OracleReportBean bean = (OracleReportBean)request.getSession().getAttribute("reportBean");
        OutputStream out = response.getOutputStream();
        bean.run(out);
        out.close();
      }This allows the bean to generate reports.

  • Problem with Action binding for a command button in a Managed Bean

    Hi
    Thank you for reading my post
    I am trying to use a backing bean for a button action binding.
    I followed all steps as they seems to be correct. i did not made any changes directly by hand , all of changes are introduced by oracle
    Jdeveloper wizards. but now i get this exception
    Managed bean is defined in faces-config.xml (it shows in preview mode) , the method is there in managed bean (Jdeveloper itself create the method i just enter its name)
    can you please take a look and tell me what can be wrong?
    thanks
    here is method and its body in managed bean
    public String userAccept_action() {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding =
                bindings.getOperationBinding("Commit");
            Object result = operationBinding.execute();
            if (!operationBinding.getErrors().isEmpty()) {
                return null;
            return null;
        }here is the exception that i recive
    javax.faces.FacesException: #{ButtonActions.userAccept_action}: javax.faces.el.EvaluationException: javax.faces.FacesException: javax.faces.FacesException: The scope of the referenced object: '#{bindings}' is shorter than the referring object
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
         at oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:211)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.adf.share.security.authentication.AuthenticationFilter.handleAuthentication(AuthenticationFilter.java:177)
         at oracle.adf.share.security.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:112)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at webui.common.CharacterEncoding.doFilter(CharacterEncoding.java:26)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
         at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:105)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:167)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
         at oracle.security.jazn.oc4j.JAZNFilter$1.run(JAZNFilter.java:396)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAs(Subject.java:396)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:415)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:619)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:619)
    Caused by: javax.faces.el.EvaluationException: javax.faces.FacesException: javax.faces.FacesException: The scope of the referenced object: '#{bindings}' is shorter than the referring object
         at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:190)
         at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:143)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:143)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         ... 34 more
    Caused by: javax.faces.FacesException: javax.faces.FacesException: The scope of the referenced object: '#{bindings}' is shorter than the referring object
         at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:292)
         at com.sun.faces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:97)
         at oracle.adfinternal.view.faces.el.AdfFacesVariableResolver.resolveVariable(AdfFacesVariableResolver.java:40)
         at oracle.adfinternal.view.faces.model.VariableResolverUtils$JspResolver.resolveVariable(VariableResolverUtils.java:79)
         at com.sun.faces.el.impl.NamedValue.evaluate(NamedValue.java:145)
         at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:263)
         at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:160)
         ... 37 more
    Caused by: javax.faces.FacesException: The scope of the referenced object: '#{bindings}' is shorter than the referring object
         at com.sun.faces.config.ManagedBeanFactory.evaluateValueBindingGet(ManagedBeanFactory.java:911)
         at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:567)
         at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:253)
         at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:282)
         ... 43 more

    Thank you for reply , but it does not helps or maybe i did not apply it correctly
    here is faces-config.xml code snippet :
    <managed-bean>
        <managed-bean-name>ButtonActions</managed-bean-name>
        <managed-bean-class>webui.common.actionListener.ButtonAction</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
        <managed-property>
          <property-name>bindings</property-name>
          <value>#{bindings}</value>
        </managed-property>
      </managed-bean>here is binding for the button in jsp file :
    <af:commandButton
                                    text="#{res['button.accept']}"
                                    disabled="#{!bindings.Commit.enabled}"
                                    action="#{ButtonActions.userAccept_action}"/>and here is some code portion of ButtonAction class
    package webui.common.actionListener;
    import oracle.binding.BindingContainer;
    import oracle.binding.OperationBinding;
    public class ButtonAction {
        private BindingContainer bindings;
        public ButtonAction() {
        public BindingContainer getBindings() {
            return this.bindings;
        public void setBindings(BindingContainer bindings) {
            this.bindings = bindings;
        public String userAccept_action() {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding =
                bindings.getOperationBinding("Commit");
            Object result = operationBinding.execute();
            if (!operationBinding.getErrors().isEmpty()) {
                return null;
            return null;
    }and i still get the same error.

  • 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?

  • Impossible to call a action handler in managed bean

    Hello! I’d developed simple jsf-application using JDeveloper 10.1.3.3 that doesn’t use faces-config.xml for a nafigation.
    Simple jsf page (page1.jspx) has only one command button:
    <af:commandButton text="commandButton 1"
    binding="#{backing_page1.commandButton1}"
    id="commandButton1"
    action="#{backing_page1.commandButton1_action}"
    immediate="true"/>
    Action is handled programmatically in managed bean Page1.java:
    public String commandButton1_action() {
    ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
    ec.redirect("page2.jspx");
    return null;
    The sample application works fine.
    Then I’d tried to use the same jsf app to develop PDK Portlet (Oracle PDK, not jsr-168). I used Portal 10.1.4 and OC4J 10.1.3.3.
    The part of provider.xml:
    <showPage class="oracle.portal.provider.v2.render.http.ResourceRenderer">
    <resourcePath>/faces/page1.jspx</resourcePath>
    </showPage>
    Action is handled programmatically in managed bean Page1.java:
    public String commandButton1_action() {
    ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
    ec.redirect("http://<hostname>:7778/portal/page/portal/SampleGroup/Sample6");
    return null;
    Unfortunately, the jsf page doesn’t call an action after submit of the button. It’s impossible to call any handler in managed bean. Although, it’s possible in usual jsf app.
    I wonder that af:goLink on the page1.jspx works fine:
    <af:goLink text="goLink 1" binding="#{backing_page1.goLink1}"
    id="goLink1"
    destination=" http://<hostname>:7778/portal/page/portal/SampleGroup/Sample6"/>
    The ask: why jsf page can’t call an action handler in managed bean in case of a portlet development?
    Thank you. Andrew

    Thank you, Frank! I’d expected an answer from you:) I and my colleagues is your big funs:)
    I’d understood Portal intercepts any event on a portal page before jsf event.
    But, it’s possible to use struts for portlet development. I’d hoped there is the same approach for Faces too (oracle.portal.provider.v2.render.http.FacesRenderer - http://www.oracle.com:80/technology/products/webcenter/files/pdk_downloads/jpdk/oracle/portal/provider/v2/render/http/FacesRenderer.html).
    WebCenter is fine product but one is expensive. May be, is there a way to develop jsf portlet outside webcenter?
    Thanks, Andrew

  • 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!!

  • 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

  • Generate PDF using Managed Bean with custom HTTP headers

    Background
    Generate a report in various formats (e.g., PDF, delimited, Excel, HTML, etc.) using JDeveloper 11g Release 2 (11.1.2.3.0) upon clicking an af:commandButton. See also the StackOverflow version of this question:
    http://stackoverflow.com/q/13654625/59087
    Problem
    HTTP headers are being sent twice: once by the framework and once by a bean.
    Source Code
    The source code includes:
    - Button Action
    - Managed Bean
    - Task Flow
    Button Action
    The button action:
    <af:commandButton text="Report" id="submitReport" action="Execute" />
    Managed Bean
    The Managed Bean is fairly complex. The code to `responseComplete` is getting called, however it does not seem to be called sufficiently early to prevent the application framework from writing the HTTP headers.
    HTTP Response Header Override
    * Sets the HTTP headers required to indicate to the browser that the
    * report is to be downloaded (rather than displayed in the current
    * window).
    protected void setDownloadHeaders() {
    HttpServletResponse response = getServletResponse();
    response.setHeader( "Content-Description", getContentDescription() );
    response.setHeader( "Content-Disposition", "attachment, filename="
    + getFilename() );
    response.setHeader( "Content-Type", getContentType() );
    response.setHeader( "Content-Transfer-Encoding",
    getContentTransferEncoding() );
    Issue Response Complete
    The bean indirectly tells the framework that the response is handled (by the bean):
    getFacesContext().responseComplete();
    Bean Run and Configure
    public void run() {
    try {
    Report report = getReport();
    configure(report.getParameters());
    report.run();
    } catch (Exception e) {
    e.printStackTrace();
    private void configure(Parameters p) {
    p.put(ReportImpl.SYSTEM_REPORT_PROTOCOL, "http");
    p.put(ReportImpl.SYSTEM_REPORT_HOST, "localhost");
    p.put(ReportImpl.SYSTEM_REPORT_PORT, "7002");
    p.put(ReportImpl.SYSTEM_REPORT_PATH, "/reports/rwservlet");
    p.put(Parameters.PARAM_REPORT_FORMAT, "pdf");
    p.put("report_cmdkey", getReportName());
    p.put("report_ORACLE_1", getReportDestinationType());
    p.put("report_ORACLE_2", getReportDestinationFormat());
    Task Flow
    The Task Flow calls Execute, which refers to the bean's `run()` method:
    entry -> main -> Execute -> ReportBeanRun
    Where:
    <method-call id="ReportBeanRun">
    <description>Executes a report</description>
    <display-name>Execute Report</display-name>
    <method>#{reportBean.run}</method>
    <outcome>
    <fixed-outcome>success</fixed-outcome>
    </outcome>
    </method-call>
    The bean is assigned to the `request` scope, with a few managed properties:
    <control-flow-rule id="__3">
    <from-activity-id>main</from-activity-id>
    <control-flow-case id="ExecuteReport">
    <from-outcome>Execute</from-outcome>
    <to-activity-id>ReportBeanRun</to-activity-id>
    </control-flow-case>
    </control-flow-rule>
    <managed-bean id="ReportBean">
    <description>Executes a report</description>
    <display-name>ReportBean</display-name>
    <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    The `<fixed-outcome>success</fixed-outcome>` strikes me as incorrect -- I don't want the method call to return to another task.
    Restrictions
    The report server receives requests from the web server exclusively. The report server URL cannot be used by browsers to download directly, for security reasons.
    Error Messages
    The error message that is generated:
    Duplicate headers received from server
    Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple distinct Content-Disposition headers received. This is disallowed to protect against HTTP response splitting attacks.Nevertheless, the report is being generated. Preventing the framework from writing the HTTP headers would resolve this issue.
    Question
    How can you set the HTTP headers in ADF while using a Task Flow to generate a PDF by calling a managed bean?
    Ideas
    Some additional ideas:
    - Override the Page Lifecycle Phase Listener (`ADFPhaseListener` + `PageLifecycle`)
    - Develop a custom Servlet on the web server
    Related Links
    - http://www.oracle.com/technetwork/middleware/bi-publisher/adf-bip-ucm-integration-179699.pdf
    - http://www.slideshare.net/lucbors/reports-no-notes#btnNext
    - http://www.techartifact.com/blogs/2012/03/calling-oracle-report-from-adf-applications.html?goback=%2Egde_4212375_member_102062735
    - http://docs.oracle.com/cd/E29049_01/web.1112/e16182/adf_lifecycle.htm#CIABEJFB
    Thank you!

    The problem was that the HTTP headers were in fact being written twice:
    1. The report server was returning HTTP response headers.
    2. The bean was including its own HTTP response headers (as shown in the question).
    3. The bean was copying the entire contents of the report server response, including the headers, into the output stream.
    Firefox ignored the duplicate header errors, but Google Chrome did not.

  • Can't get JSF to access managed bean methods from web page

    I'm using NetBeans 6.7.1 and Glassfish v2.1
    Having problems here can somebody please help? It is really
    frustrating because I have written apps like this before in fact I
    used one as a model to create an even simpler app and still can't get
    it to work. I ran it through the debugger and it stops in the
    constructor so it looks like the bean object is being created, but the
    setUid method and the testit method are not being entered when I click
    on the enter commandbutton. Can somebody PLEASE give me an idea as to
    what might be going on? I am totally stumped and this is holding up
    some important work I need to get done. Any help would be greatly
    appreciated:
    web.xml:
    - Show quoted text -
    <?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">
    <context-param>
    <param-name>com.sun.faces.verifyObjects</param-name>
    <param-value>false</param-value>
    </context-param>
    <context-param>
    <param-name>com.sun.faces.validateXml</param-name>
    <param-value>true</param-value>
    </context-param>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    </context-param>
    <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>
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
    <welcome-file>faces/welcomeJSF.jsp</welcome-file>
    </welcome-file-list>
    </web-app>
    faces-config.xml:
    <?xml version='1.0' encoding='UTF-8'?>
    <!-- =========== FULL CONFIGURATION FILE ================================== -->
    <faces-config version="1.2"
    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-facesconfig_1_2.xsd">
    <managed-bean>
    <managed-bean-name>testbean</managed-bean-name>
    <managed-bean-class>com.lingosys.quoteest.testbean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    <navigation-rule>
    <from-view-id>/go.jsp</from-view-id>
    <navigation-case>
    <from-outcome>correct</from-outcome>
    <to-view-id>/ok.jsp</to-view-id>
    <redirect/>
    </navigation-case>
    </navigation-rule>
    </faces-config>
    go.jsp:
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%--
    This file is an entry point for JavaServer Faces application.
    --%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>JSP Page</title>
    </head>
    <body>
    <f:view>
    <h1>JAS Generator</h1>
    <p/>
    <h:form id="testForm" enctype="multipart/form-data" >
    <p/>Both fields are required.
    <p/>Enter Test ID: <h:inputText id="pid"
    value="#{testbean.uid}" required="true"/>
    <p/><h:commandButton value="Enter"
    action="#{testbean.testit}"/>
    </h:form>
    </f:view>
    </body>
    </html>
    testbean.java:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package com.lingosys.quoteest;
    * @author mphoenix
    public class testbean {
    private String uid;
    public testbean() {
    int x=0;
    public String getUid() {
    return uid;
    public void setUid(String uid) {
    this.uid = uid;
    public String testit() {
    return "correct";
    }

    MikePhoenix wrote:
    enctype="multipart/form-data"
    Why?
    Oh, in the future please post code in code blocks. Use the CODE button to get them. Use the Preview tab to see if anything went right.

  • Can't set managed bean property:

    Hi,
    I am trying to experiment with JSF and I am extending an example I downloaded from the web. When I added a new secret field and extened the bean. I get the following error. I trying to resolve this problem from two days , cant figure out why I get this exception. I tried changed the property name I still get the same error. It is something to do with the bean, I am not sure why its not able to set the property, I know that the get and set methods exist in the class file. Any help would be greatly appreciated . I have pasted the bean file, faces-config.xml, and the inputname.jsp file below. Thanks a lot.
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: javax.faces.FacesException: javax.faces.FacesException: Can't set managed bean property: 'word'.
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
         at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
         at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:430)
         at org.apache.jsp.index_jsp._jspService(index_jsp.java:48)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
         at java.lang.Thread.run(Thread.java:536)
    root cause
    javax.servlet.ServletException: javax.faces.FacesException: javax.faces.FacesException: Can't set managed bean property: 'word'.
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:531)
         at org.apache.jsp.inputname_jsp._jspService(inputname_jsp.java:94)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
         at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
         at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:430)
         at org.apache.jsp.index_jsp._jspService(index_jsp.java:48)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
         at java.lang.Thread.run(Thread.java:536)
    My JSP file is
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <f:loadBundle basename="demo.bundle.Messages" var="Message"/>
    <HTML>
    <HEAD> <title>Input Name Page</title> </HEAD>
    <body bgcolor="white">
         <f:view>
              <h1><h:outputText value="#{Message.inputname_header}"/></h1>
              <h:messages style="color: red"/>
         <h:form id="helloForm" >
              <h:outputText value="#{Message.prompt}"/>
              <h:inputText id="userName" value="#{GetNameBean.userName}" required="true">
                   <f:validateLength minimum="2" maximum="10"/>
              </h:inputText>
              <h:inputSecret id="word" value="#{GetNameBean.word}" required="true">
                   <f:validateLength minimum="2" maximum="10"/>
              </h:inputSecret>
              <h:commandButton id="submit" action="sayhello" value="Say Hello" />
         </h:form>
    </f:view>
    </HTML>
    My faces-config.xml is as follow
    <?xml version="1.0"?>
    <!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
    <navigation-rule>
    <from-view-id>/inputname.jsp</from-view-id>
    <navigation-case>
    <to-view-id>/greeting.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    <managed-bean>
    <description>
    Input Value Holder
    </description>
    <managed-bean-name>GetNameBean</managed-bean-name>
    <managed-bean-class>demo.GetNameBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    <managed-property>
    <property-name>userName</property-name>
    <property-class>java.lang.String</property-class>
    <value></value>
         </managed-property>
         <managed-property>
    <property-name>word</property-name>
         <property-class>java.lang.String</property-class>
         <value></value>
         </managed-property>
    </managed-bean>
    </faces-config>
    My bean file is as follows GetNameBean.java
    package demo;
    * @author Sergey Smirnov. Exadel, Inc.
    public class GetNameBean {
    private String userName;
    private String word;
    * @return User Name
    public String getUserName() {
    return userName;
    * @param User Name
    public void setUserName(String name) {
    this.userName = name;
    * @return Password
    public String getWord() {
    return word;
    * @param Password
    public void setWord(String word) {
    this.word = word;

    Hello,
    Thanks for the reply. I used Camelcase, but its giving me the same error. I am also posting my bean files and jsp files for your reference.
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: org.apache.jasper.JasperException: javax.faces.FacesException: javax.faces.FacesException: Can't set managed bean property: 'UserName'.
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
         org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    root cause
    javax.faces.FacesException: org.apache.jasper.JasperException: javax.faces.FacesException: javax.faces.FacesException: Can't set managed bean property: 'UserName'.
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:327)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.
    LOGIN.JSP file
    <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
    <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
    <f:view>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <f:verbatim escape="false">
    <head>
    <title>My JSP 'login.jsp' starting page</title>
         <meta http-equiv="pragma" content="no-cache">
         <meta http-equiv="cache-control" content="no-cache">
         <meta http-equiv="expires" content="0">
         <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
         <meta http-equiv="description" content="This is my page">
         <!--
         <link rel="stylesheet" type="text/css" href="styles.css">
         -->
    </head>
    </f:verbatim>
    <body>
    <h:form rendered="true" id="loginform">
    <f:verbatim escape="false"><br><br> </f:verbatim>
    <h:outputLabel for="userName" rendered="true"></h:outputLabel>
    <h:inputText id="userName" required="true" rendered="true" value="#{UserBean.userName}"></h:inputText>
    <f:verbatim escape="false"><br> </f:verbatim>
    <h:outputLabel for="password" rendered="true"></h:outputLabel>
    <h:inputSecret id="password" redisplay="false" required="true" rendered="true" value="#{UserBean.password}"></h:inputSecret>
    <h:commandButton id="submit" action="#{UserBean.loginUser}" rendered="true" value=" Submit"></h:commandButton><br><br></h:form>
    </body>
    </html>
    </f:view>
    UserBean file
    package com.jsfdemo.bean;
    import javax.faces.application.FacesMessage;
    import javax.faces.context.FacesContext;
    * @author ExterroAdmin
    public final class UserBean extends Object
         private String password;
         private String userName;
         public UserBean()
              super();
         public String getPassword()
              return password;
         public void setPassword(String password)
              this.password = password;
         public String getUserName()
              return userName;
         public void setUserName(String userName)
              this.userName = userName;
         public String loginUser() {
    if("myeclipse".equals(getUserName()) && "myeclipse".equals(getPassword()))
    return "success";
    FacesContext facesContext = FacesContext.getCurrentInstance();
    FacesMessage facesMessage = new FacesMessage(
    "You have entered an invalid user name and/or password");
    facesContext.addMessage("loginForm", facesMessage);
    return "failure";
    If you need any more information, please let me know

  • Not working Manage bean

    Dear experts,
    Im using JDeveloper 11.1.2.2.0
    I created manage bean for cetain command button in my jsf page.
    This is the code of MB:
    package common.model.view;
    import javax.faces.event.ActionEvent;
    public class abc {
    public abc() {
    public void getSelectedRow(ActionEvent actionEvent) {
    // Add event code here...
    System.out.println("Testing.......");
    But after running the web page, it shows following error when clicking the command button.
    Pls advice me to solve this.
    Thanks
    Charith
    <MethodExpressionActionListener> <processAction> Received 'javax.el.PropertyNotFoundException' when invoking action listener '#{xxxxxxxx.yyyyyyy}' for component 'cb1'
    <MethodExpressionActionListener> <processAction> javax.el.PropertyNotFoundException: //C:/Users/charithk/AppData/Roaming/JDeveloper/system11.1.2.2.39.61.83.1/o.j2ee/drs/LifePolicy/LifePolicyViewCntWebApp.war/LifePolicyPage.jsf @75,117 actionListener="#{xxxxxxxx.yyyyyyy}": Target Unreachable, identifier 'xxxxxxxx' resolved to null
         at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:107)
         at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
         at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcast(UIXComponentBase.java:824)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:179)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:112)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:106)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:970)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:351)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:207)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

    It looks like the bean was not found. Did you define it in your adfc-config.xml or a btf config? Ensure the names of the bean defined in one of the former config files match. Otherwise, verify proper scope of the bean.

  • Managed Beans and Data Access Object

    I have a question / need help understanding how to configure backing bean and model objects so that memory and object creation/deletion is done as efficiently as possible.
    1. I have a .jsf page with a form and a commandbutton that submits the form inputs to a backing bean (enrollispbean is backing bean)
    <h:commandButton value="Enter" action="#{enrollispbean.insert}"/>
    2. The backing bean is used for form handling - the insert() method is used to read the data fields from the form and create a SQL string that will be submitted to a model object, DbInsert, that is used as a generic data access object that connects to the database and insert the SQL string:
    public class EnrollIspBean {
    private String beanvar1="";
    private String beanvar2= "";
    // DbInsert is data access object
    private DbInsert dbinsert = new DbInsert();
    public String insert (){
    String sqlstmt;
    sqlstmt = "INSERT INTO ispmain VALUES(beanvar1, beanvar2,..)"
    dbinsert.insert(sqlstmt);
    return "success"; }
    3. DbInsert is the data access object that contains a method, insert(), that accepts a sql string to insert into the database. This method contains the code to obtain a connection from the database connection pool and then execute the sql statement (note: error checking code not shown):
    public class DbInsert {
    public void insert(String sqlstmt) throws SQLException {
    Connection conn = null;
    GetDBConnection getdbconnection = new GetDBConnection();
    PreparedStatement stmt = null;
    conn = getdbconnection.getdbconn();
    stmt = conn.prepareStatement(sqlstmt);
    stmt.executeUpdate();
    stmt.close();
    conn.close();
    return;
    Where I need help understanding is how to set up the scope for the managed beans and data access object. Currently, I have the backing bean within the session scope (using the facesconfig.xml file). My main question is how to set up the scope for the Data Access Object - currently I do not have it as a managed bean within facesconfig.xml. Instead I am creating a new instance within the backing bean:
    private DbInsert dbinsert = new DbInsert();
    Is this the best way to do this? Will the DBInsert object now be tied to the session scope of the backing bean (i.e., when backing bean is deleted, the DbInsert object will be deleted from session scope as well.)
    Ideally I would like the data access object to be available as a shared object throughout the life of the application. When I was programming using a servlet approach, I would have created a servlet to load on startup. Now that I'm using java server faces, I'm confused about the scope / how to efficiently set up a data access object that I want to be available to all backing beans in the application.
    tnanks for any help understanding this.
    Tom

    I was thinking about setting the data access object as application scope so that it can be used by an backing bean to execute sql statements.
    If I do set it as application scope, however, if I do this, do I still need to declare a new instance of the object from within each bean that uses the object?
    For example do I need to declare a new instance of the data access object from within the bean? or, should I assume that there is always an instance of the bean available in the application scope, and if so, how do I reference it from within the bean?
    Bean Code:
    public class EnrollIspBean {
    // DbInsert is data access object
    private DbInsert dbinsert = new DbInsert();
    Finally, I understand performance may be an issue if I have one instance of the data access object available in the application scope - is there a way to make multiple instances available in the application scope?
    thanks

  • Reset session bean

    Hi,
    I am in the situation where I have to fill in some data on page one, this data is saved in a session managed bean and used in a second page.
    After finishing page two the proces is done and the user should be redirected to a new empty first page again.
    The problem that I run into is when I use a navigation-rule to navigate back to the first the original data is still there. Offcourse it is possible to clear all items one by one but what I like to know if there is a way to clear all data at once (reset sessionbean??)
    Thanks Erik

    Do you want to reset your session or just the one session bean?
    When the user clicks the button to complete the process, you can easily do either one of these. In the action method that is executed upon the button click add the following code:
    For resetting your session:
              //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();For resetting just one Session bean:
              FacesContext.getCurrentInstance().getExternalContext().
                   getSessionMap().remove("beanName");Easy eh?
    CowKing

  • How to pop up a browser window from a managed bean?

    I have a user case like this:
    User login our home website. He/she clicks a button. Control flow goes to a managed bean (MB here after) to check some conditions. If conditions are met, instead of sending the user back to the home page, the user will be presented a new web site (e.g. forums.oracle.com) in a popup window on top of our home site.
    Can we invoke a website in a adf popup? If so, how to do that? If not, any idea on how to develop this use case?
    Any idea is appreciated.

    Sorry, I have updated the previous reply with the required inputs.
    For convenience, putting it again;
    if you need to check for some condition and then invoke the browser, you could use the following code in your managed bean for af:commandButton for Action.
    import javax.faces.context.FacesContext;
    import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
    import org.apache.myfaces.trinidad.util.Service;
    public class TestURLPageBean {
    public TestURLPageBean() {
    super();
    public String onClick() {
    *// Check for the condition here and invoke the browser only if it is true*
    if (true) {
    ExtendedRenderKitService erks =
    (ExtendedRenderKitService)Service.getRenderKitService(FacesContext.getCurrentInstance(),
    ExtendedRenderKitService.class);
    StringBuilder script = new StringBuilder();
    script.append("window.open('http://www.google.com');");
    erks.addScript(FacesContext.getCurrentInstance(),
    script.toString());
    return null;
    Thanks,
    Navaneeth

Maybe you are looking for

  • Hard Drive Not Recognized/Not Accessible

    Hello, i have a MBP late 2011, and the hard drive it initially came with, i'm using it as a 2nd drive, with the data doubler set up. My primary drive now is a Samsung SSD. All of a sudden, I cannot access the drive. Initially I named this drive to "P

  • WLS 7.0 SP2 Cluster deployment problems

    I am having problems deploying our application to a weblogic cluster. Environment is windows 2000/XP and weblogic 7.0 SP2. Here's a simplified version of the cluster. I have 2 managed servers that are part of the cluster.I have defined the managed se

  • How I know if my computer have a virus?

    My computer is slow and the itunes show up by his self? is a virus?

  • Compilation problem with templates while using option -m64

    Hi, I have compilation problem with template while using option -m64. No problem while using option -m32. @ uname -a SunOS snt5010 5.10 Generic_127111-11 sun4v sparc SUNW,SPARC-Enterprise-T5220 $ CC -V CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007

  • Using "Enter Key" on Button launches new window

    I've written a Google Search portlet using the Google API. The user enters a Search Term in a text box and then clicks on a button to begin the search. It works fine as long as the user clicks the button with the mouse. However, I'm finding that many