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

Similar Messages

  • Problems with managed beans on included JSPs

    I've got a problem with managed beans within an included JSP
    The included page looks as follows:
    <f:subview id="includedPage" binding="#{testBean.component}">
         <h:outputText value="Hallo from the included page"/>
         <h:outputText value="#{testBean.msg}" />
    </f:subview>The including page is also very simple
    <f:view>
         <html>
              <head>
                   <title>Test include</title>
              </head>
              <body>
                   <h:outputText value="Hello from the including page"/>               
                   <jsp:include page="included.jsp"/>
              </body>
         </html>
    </f:view>The testBean is a managed bean with page scope and looks as follows:
    public class TestBean {
        public UIComponent fComponent;
        public TestBean() {
            System.out.println("TestBean Constructor called " + toString() );
        public String getMsg() {
            return "Component = " + fComponent ;
        public void setComponent(UIComponent component) {
            System.out.println("setComponent called " + component);       
            fComponent = component;
        public UIComponent getComponent() {
            System.out.println("getComponent called " + fComponent);
            return fComponent;
    }The output to the console is:
    TestBean Constructor called de.kvb.athena.web.beans.TestBean@1bc16f0
    getComponent called null
    TestBean Constructor called de.kvb.athena.web.beans.TestBean@18622f3
    setComponent called javax.faces.component.UINamingContainer@160877b
    TestBean Constructor called de.kvb.athena.web.beans.TestBean@5eb489
    and the page displays
    Hello from the include page
    Hello from the included page Component = null
    Can anyone explain this behavior ? What's the reason that the page displays
    Component = null
    and is it possible to display the parent naming container (subview) this way ?
    how ?
    Thanks

    By "page scope" I assume you mean "none"? If so JSF creates a new bean for each place it's referenced. The closest to the behavior you want, once per "page", is really request scope.
    (I'm not sure why the constructor is being called thrice, though. I should look into this.)
    I assume you want a bean-per-subview scenario. This should be doable, and one way that allows a dynamic number of subviews would be as follows:
    --create a "manager" bean in request scope
    --give it get/set methods that retrieves a Map of "TestBean" instances; the idea is that each subview use a different key "s1", "s2", etc
    back the manager method with Map implementation that checks if there's already a TestBean associated with the key returns it if yes, else null.
    If that seems messy, the component solution is hairy :-) See http://forum.java.sun.com/thread.jspa?threadID=568937&messageID=2812561
    --A                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • ADF Faces and BC: Scope problem with managed bean

    Hi,
    I am using JDev 10.1.3 and ADF Faces with ADF BC.
    I have created a managed bean which needs to interact with the binding layer and also receive actions from the web pages. I have a managed property on the bean which is defined as follows:
    <managed-bean>
        <managed-bean-name>navigator</managed-bean-name>
        <managed-bean-class>ecu.ethics.view.managed.Navigator</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
        <managed-property>
          <property-name>bindings</property-name>
          <value>#{bindings}</value>
        </managed-property>
      </managed-bean>I need the been to session scope because it needs to keep previous and next pages to navigate the user through their proposal. If i use session scope (as above) i get the following error when i click on a comand link which references a method in the above bean: #{navigator.forwardNext_action} which returns a global forward.
    this is the exception:
    javax.faces.FacesException: #{navigator.forwardNext_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:78)     at
    oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:211) at
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)at
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)     at
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)     at
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)     
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)     at
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)how can i get around this?
    Brenden

    Hi pp,
    you need to create a managed (not backing) been set to session scope.
    You can call/reference the managed bean from your page.
    the backing bean is designed around a page lifecyle which is request oriented in it's design.
    This is a simple managed bean from faces-config.xml
    <managed-bean>
        <managed-bean-name>UserInfo</managed-bean-name>
        <managed-bean-class>ecu.ethics.admin.view.managed.UserInfo</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
          <managed-property>
          <property-name>bindings</property-name>
          <property-class>oracle.adf.model.BindingContext</property-class>
          <value>#{data}</value>
        </managed-property>
      </managed-bean>and the getters and setters for bindings in your session scope managed bean:
        public void setBindings(BindingContext bindings) {
            this._bindings = bindings;
        public BindingContext getBindings() {
            return _bindings;
        }you can access the model from the managed bean using the the BindingContext if needed.
    also have a look at JSFUtils from the ADF BC SRDemo application, there are methods in this class such as resolveExpression which demonstrate how to get the values of items on your page programatically using expression language. You can use this in your managed bean to get values from your pages.
    regards,
    Brenden

  • JSF1063 Warning With Managed Bean

    With Glassfish V3 it outputs a JSF 1063 warning to do with not being able to serialise an object. Below is the Glassfish log:
    INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
    INFO: nullID: /home/nick/NetBeans Projects/EAA Website/build/web/ CLASSES: [class nz.co.eaa.FeedbackController, class nz.co.eaa.ServicesController, class nz.co.eaa.Feedback, class nz.co.eaa.ApplicationController]
    INFO: Initializing Mojarra 2.0.2 (FCS b10) for context '/eaa'
    INFO: Monitoring jndi:/server/eaa/WEB-INF/faces-config.xml for modifications
    INFO: Loading application EAA_Website at /eaa
    INFO: EAA_Website was successfully deployed in 746 milliseconds.
    WARNING: JSF1063: WARNING! Setting non-serializable attribute value into HttpSession (key: feedback, value class: nz.co.eaa.Feedback).What is really bizarre is that the managed bean (Feedback) is session scoped, therefore it should be serialised across a session (HTTP session). Also the managed bean has a null ID which may contribute to the problem. Here are the contents of Feedback.java:
    package nz.co.eaa;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.SessionScoped;
    @ManagedBean(name = "feedback")
    @SessionScoped
    public class Feedback
        private String firstName = "";
        private String lastName = "";
        private String email = "";
        private String phoneNum = "";
        private String address = "";
        private String subject = "";
        private String message = "";
        private String priority = "";
        /** Creates a new instance of Feedback */
        public Feedback()
            // Do nothing.
        public String getAddress()
            return address;
        public void setAddress(String address)
            this.address = address;
        public String getEmail()
            return email;
        public void setEmail(String email)
            this.email = email;
        public String getFirstName()
            return firstName;
        public void setFirstName(String firstName)
            this.firstName = firstName;
        public String getLastName()
            return lastName;
        public void setLastName(String lastName)
            this.lastName = lastName;
        public String getMessage()
            return message;
        public void setMessage(String message)
            this.message = message;
        public String getPhoneNum()
            return phoneNum;
        public void setPhoneNum(String phoneNum)
            this.phoneNum = phoneNum;
        public String getPriority()
            return priority;
        public void setPriority(String priority)
            this.priority = priority;
        public String getSubject()
            return subject;
        public void setSubject(String subject)
            this.subject = subject;
    }Here are the contents of feedback.xhtml:
    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:f="http://java.sun.com/jsf/core">
        <ui:composition template="layout.xhtml">
            <ui:define name="content">
                <h1 id="content-title">Feedback</h1>
                <f:view>
                    <h:form>
                        <h:outputLabel value="#{feedbackController.labelNames['firstName']}"
                                       for="firstName" />
                        <h:inputText id="firstName"
                                     value="#{feedback.firstName}" />
                        <h:outputLabel value="#{feedbackController.labelNames['lastName']}"
                                       for="lastName" />
                        <h:inputText id="lastName"
                                     value="#{feedback.lastName}" />
                        <h:outputLabel value="#{feedbackController.labelNames['email']}"
                                       for="email" />
                        <h:inputText id="email"
                                     value="#{feedback.email}" />
                        <h:outputLabel value="#{feedbackController.labelNames['phoneNum']}"
                                       for="phoneNum" />
                        <h:inputText id="phoneNum"
                                     value="#{feedback.phoneNum}" />
                        <h:outputLabel value="#{feedbackController.labelNames['addr']}"
                                       for="addr" />
                        <h:inputTextarea id="addr"
                                         value="#{feedback.address}" />
                        <h:outputLabel value="#{feedbackController.labelNames['subject']}"
                                       for="subject" />
                        <h:selectOneListbox value="#{feedback.subject}"
                                            id="subject">
                            <f:selectItems var="item" itemLabel="#{item}"
                                           itemValue="#{item}"
                                           value="#{feedbackController.subjects}"/>
                        </h:selectOneListbox>
                        <h:outputLabel value="#{feedbackController.labelNames['msg']}"
                                       for="msg" />
                        <h:inputTextarea id="msg"
                                         value="#{feedback.message}" />
                        <h:outputLabel value="#{feedbackController.labelNames['priority']}"
                                       for="subject" />
                        <h:selectOneListbox value="#{feedback.priority}">
                            <f:selectItems var="item" itemLabel="#{item}"
                                           itemValue="#{item}"
                                           value="#{feedbackController.priorities}"/>
                        </h:selectOneListbox>
                    </h:form>
                </f:view>
            </ui:define>
        </ui:composition>
    </html>Currently when feedback.xhtml is visited nothing is saved to the HTTP session even though feedback's properties are bound to the JSF controls in feedback.xhtml. Has anyone encountered a similar problem where a session scoped managed bean is not persisted in a HTTP session?

    Interesting that the container would attempt to persist a session to disk, or some other persistent storage if the session times out. This would explain why there was a warning message that appeared in the Glassfish log. Below is the contents of FeedbackController.java:
    package nz.co.eaa;
    import java.util.HashMap;
    import java.util.Map;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.NoneScoped;
    @ManagedBean(name = "feedbackController")
    @NoneScoped
    public class FeedbackController
        private Map<String, String> labelNames = new HashMap<String, String>();
        private String[] subjects = {"Inquiry", "Comment", "Quotes"};
        private String[] priorities = {"Low", "Medium", "High"};
        /** Creates a new instance of FeedbackController */
        public FeedbackController()
            labelNames.put("firstName", "First Name:");
            labelNames.put("lastName", "Last Name:");
            labelNames.put("email", "Email:");
            labelNames.put("phoneNum", "Phone Number:");
            labelNames.put("addr", "Address:");
            labelNames.put("subject", "Subject:");
            labelNames.put("msg", "Message:");
            labelNames.put("priority", "Priority:");
        public String[] getPriorities()
            return priorities;
        public String[] getSubjects()
            return subjects;
        public Map<String, String> getLabelNames()
            return labelNames;
    }As for FeedbackController it is set for None scope since some data is contained within the managed bean itself. All data bindings to the FeedbackController are receiving the correct values so this isn't the actual issue. The real issue is data not being retrieved from Feedback when it is filled with data (supposedly), hence all form data is lost when feedback.xhtml is refreshed.
    Although this may not be needed I have included the contents of web.xml below just in case:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.0" 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_3_0.xsd">
        <context-param>
            <param-name>javax.faces.PROJECT_STAGE</param-name>
            <param-value>Development</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/index.xhtml</welcome-file>
        </welcome-file-list>
    </web-app>

  • Best practices with managed bean

    Hi, I have 7 jsf which have 4 listaschoice and checkbox all use the same.
    the difference is that when running the action of the button, going to run a different, now I have one for the 7 jsf bean and the only thing that changed is the method of action of the button, which I recommend, I say use every jsf by bean

    thanks,
    another question, you have experience in adf, I wonder if this framework has the ability to run processes pl/sql,
    as this I'm doing everything with button actions, and execute the method that executes the process, for example:
        public String buttonfagepr() { //Generacion de procesos(detalles) fagepr.jsf
            String vaProceso = "Generacion de procesos";
            String vaProcedimiento = "ARQU.mbfacturacion.fnuProcFact";
            String vaTipo = "S";
            String modulo = "FA";
            String[] datosGenXML = new String[2];
            //"IdParametro", "TipoParam", "TipoDato", "Order", "Value"
            //System.out.println(this.periodo);
            datosGenXML[0] = "c#,#IN#,#NUMBER#,#1#,#" + super.getPeriodo();
            datosGenXML[1] = "mensajeError#,#OUT#,#VARCHAR2#,#2#,# ";
            ArqUtils.procedures(vaProceso, vaProcedimiento, vaTipo, modulo, datosGenXML);
            return null;
    I want to know if the framework has the option of running processes pl / sql ...thanks timo

  • Scope of managed bean for a modifiable list

    I have a business entity set stored in database. I want to show them with JSF as elements of a list with each element having a delete button. If the database changes in the background because entitites are removed or inserted, the delete function certainly must work well.
    I'm clear of the key stuff I have to use:
    -a managed bean, probably containing some list coming from database through dao or o/r mapper.
    -some iterator, e.g. t:dataList (using Tomahawk)
    -h:commandButton with action referring to methods in the managed-bean's elements.
    The question is, what usually would be the scope of the managed-bean.
    If the scope is "request", delete function may work wrong when database changes between the first and the "delete" request.
    -First request: managed-bean created with ids and event handlers.
    -Database changes: new entity is inserted.
    -Secont request: managed-bean created with id-s and event handlers according to the new database content. id-s have been shifted.
    It may help if I override somehow the default id generation of the JSF, by using directly id-s of business entities but I think it's an unproposed hack.
    If the scope of the managed bean is "session", the delete function works well, however we've a lot of stuff to store in the session.
    So, what would be the scope of the managed-bean?
    Or a completely different approach should be used?

    hi,
    faces-config:---------
    <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">
    <!-- ***************Country************-->
    <managed-bean>
    <managed-bean-name>countryMBean</managed-bean-name>
    <managed-bean-class>com.tnhsp.mbeans.CountryMBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <!-- ***************country************-->
    <navigation-case> <!-- DEfault mode - Fetches all data in datatable -->
    <from-outcome>fetch_country</from-outcome>
    <to-view-id>/hospitalAdmin/country/countryDisplayContent.jsp</to-view-id>
    <redirect/>
    </navigation-case>
    <navigation-case> <!-- Displayes the screen to add data -->
    <from-outcome>add_country</from-outcome>
    <to-view-id>/hospitalAdmin/country/countryCreateContent.jsp</to-view-id>
    <redirect/>
    </navigation-case>
    </faces-config>
    MBEAN:-----
    public class CountryMBean {
    @EJB
    CountrySRemote countrySRemote;
    private Country country = new Country();
    public CountryMBean() {
    System.out.println("countryMBean.countryMBean()");
    country = new Country();
    fc = FacesContext.getCurrentInstance();
    public String actionAdd() {
    renderFlag = 1;
    errorStatus = "";
    System.out.println("countryMBean. - actionadd");
    retValue = "add_country";
    setLinkMode(ADD_MODE");
    setDisableCodeField("false");
    saveStatus = "false";
    listEmptyStatus = "false";
    country = new Country();
    Date dt = new Date();
    country.setEffectFromDt(dt);
    country.setCreatedDate(dt);
    country.setLastUpdatedDate(dt);
    country.setCreatedUser("user");
    country.setLastUpdatedUser("user");
    System.out.print("returning from actionadd");
    return retValue;
    Please help.

  • Setting bind variable for a view object from the Managed Bean

    Hi,
    i am using JDeveloper 11g, i have to create LOV in the JSF. To show the LOV, it has to populate data using View object and its query parameter need to be sent from the Managed Bean.
    For the View object i want to set the bind variable parameter from the managed bean value. bename is stored in a managed bean (session scope)
    #{beantest.bename}
    But it gives the following exception.
    JBO-29000: Unexpected exception caught:
    org.codehaus.groovy.control.MultipleCompilationErrorsException,msg=startup failed, Script1.groovy: 1: expecting '!',found '{'@ line1, column 2.
    I have followed the link http://kr.forums.oracle.com/forums/thread.jspa?threadID=615474 like Frank wrote on 8.2.2008:
    But steps are not clear.
    How to input the VO bind parameter with Managed bean variable?
    Any Help
    Regards
    Raj
    Edited by: user9928180 on Dec 17, 2008 9:51 AM

    Hi,
    a bind variable in a VO needs to be exposed as an executeWithParams operation in the pageDef file. Just add a new action binding to the pageDef file (context menu) and select the executeWithParams operation on teh VO. Then in the argument field, reference the managed bean property for the value
    Frank

  • Down excel file in managed bean, no response?

    Hi,
    I used JDev 11.1.2
    I want to download an excel file by click one button, and I want to implement this function in the managed bean, but after I click the button, no file download, and just refresh the page.
    JSP snippet code:
    <af:commandToolbarButton text="View Report" id="ctb1" actionListener="#{reportBean.viewReport}">
    Method of managed bean(not show exception process ):
    public void viewReport(ActionEvent actionEvent) {
    // some validation here
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExternalContext externalContext = facesContext.getExternalContext();
    HttpServletResponse response = (HttpServletResponse)externalContext.getResponse();
    BufferedInputStream input = null;
    BufferedOutputStream output = null;
    String filePath = "c:/a.xls";
    File file = new File(filePath);
    try {
    input = new BufferedInputStream(new FileInputStream(file), 1024);
    response.reset();
    response.setHeader("Content-Disposition", "attachment; filename=\"" + filePath + "\"");
    response.setContentType("application/ms-excel");
    output = new BufferedOutputStream(response.getOutputStream(), 10240);
    byte[] buffer = new byte[10240];
    int length;
    while ((length = input.read(buffer)) > 0) {
    output.write(buffer, 0, length);
    output.flush();
    }catch(Exception e){
    } finally {
    //close output and input
    facesContext.responseComplete();
    BTW: I can implement the download function by using fileDownloadActionListener, but our requirement needs to validate some information before download(such as status validation, file existence), and I add those validation to fileDownloadActionListener method, but seems no useful.
    Any advices?
    Thanks,
    zeroxin

    Timo,
    I used the solution mentioned in your blog, and it really can enter into fileDownloadActionListener method, but still not display download file dialog, just seems no useful, I test it using Firefox4 and IE9, the same result.
    JSP snippet code:
    <af:commandToolbarButton text="View Report" id="ctb1"
    actionListener="#{reportBean.viewReport}"/>
    <af:commandToolbarButton text="Export..." id="ctb2" visible="false"
    binding="#{reportBean.exportReportButton}">
    <af:fileDownloadActionListener contentType="application/vnd.ms-excel" filename="Report.xls" method="#{reportBean.reportFileDownload}" />
    </af:commandToolbarButton>
    Bean method(Snippet code)
    private RichCommandToolbarButton exportReportButton;
    public void viewReport(ActionEvent actionEvent) {
    // validate code here
    ActionEvent ae = new ActionEvent(exportReportButton);
    ae.queue();
    public void reportFileDownload(FacesContext facesContext, java.io.OutputStream outputStream) throws Exception {
    DCIteratorBinding dciter = (DCIteratorBinding)getBindings().get("SReportView1Iterator");
    Object outputLoc = dciter.getCurrentRow().getAttribute("OutputLoc");
    BufferedInputStream input = null;
    try {
    input = new BufferedInputStream(new FileInputStream((String)outputLoc), 1024);
    byte[] buf = new byte[1024];
    int count=0;
    while ((count = input.read(buf)) >= 0) {
    outputStream.write(buf, 0, count);
    input.close();
    outputStream.flush();
    outputStream.close();
    } catch (Exception e) {
    e.printStackTrace();
    thanks,
    zeroxin

  • Managed Bean Best Practices

    Hi
    Are there any best practices for using Managed Beans?
    We plan to use our own custom-built JSF components. Need to understand how to design backing beans for performance/effort optimization.
    For example :
    1. How to make managed beans thread-safe for concurrent requests, without compromising on efficiency/speed?
    2. How to enforce the J2EE security with managed-beans?
    3. How to decide the scope of these beans to ensure minimal data-storage in session?
    4. How to decide the granularity at which a managed-bean should be used for example :
    4.1 One bean-per-component
    Advantages :
    a) if complex components require special data-holding/processing/event-handling capabilities from bean
    (e.g. datagrid model,tree model,menu model)
    Problems :
    - with multiple components in a page/form
    a) it becomes tedious to debug/change/track which bean serves which component
    b) if session scope is required, too many beans will be cached in session
    c) unnecessarily too many beans will be created on server (= n pages * m components-per-page)
    d) unnecessarily increases the length of faces-config.xml
    4.2 One bean-per-form
    Advantages :
    a) in multi-form web pages, to ensure the functional behaviour of each form is separate/modular in its own bean.
    b) each managed-bean would map to specific/meaningful functionality/user-interaction in use-case.
    Problems :
    - if form includes complex components (datagrid/tree/menu) requiring a specialised bean class, then
    a) either one of the specialized bean has to be augmented with additional logic to handle data/events for all other components within the form
    (Not good, as it mixes-up the responsibilities of component-specific-beans, and the bean may no more be reusable in another form)
    b) or without using component-specific beans, only single form bean should handle the data/events for all components in the form?
    (Neither good, since if a complex tree-compoent is reused in multiple forms, then the logic to handle data/events for such a component will be repeated in those many form-specific managed beans)
    4.3 One bean-per-page
    Advantages :
    a) seems more modular/meaningful way - since a page would map to some feature within the use-case
    b) bean will contain only behaviour which is relevent for the associated page/function within use-case
    Problems :
    a) in multi-form pages, can single bean handle data/events for multiple forms?
    b) if page uses complex component (e.g datagrid, tree) that needs its own bean - how does page-bean exchange data with component-bean?
    Thanks,
    Arti

    Are there any best practices for using Managed
    Beans?There are no best practices for using Managed Beans in terms of Sun, or other vendors recommendations. But there are some patterns that can be applied to the managed beans (The managed bean is already a pattern). Also common sense is allways a good practice.
    For example, the managed bean should not have business logic code, only presentation logic code, etc.
    1. How to make managed beans thread-safe for
    concurrent requests, without compromising on
    efficiency/speed?The beans can be created by request, so concurrency is not an issue. If they are session scope, also is not an issue because, a user can only have one thread running. Only in application scope you must have carefull.
    >
    2. How to enforce the J2EE security with
    managed-beans?see this:
    http://jsf-security.sourceforge.net/
    About jsf-security
    >
    3. How to decide the scope of these beans to ensure
    minimal data-storage in session?If you wnat minimal data-storage in session the answer is request or none.
    In question 4, you make the question and give the answer ;-)

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

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

  • My CommandButton calls PostContructs from other Managed Beans. Why?

    Hi,
    i have a big problem that i can't understand.
    I use a command Button who should call only one Managed Bean. But however it calls other Managed Beans too.
    How is it possible?
    my properties:
    Primfaces 2.1
    Glassfish v3
    jsf 2.0
    Ejb 3.1
    JPA - Toplink
    Facelets
    Netbeans
    mainTemplate.xhtml
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:c="http://java.sun.com/jsp/jstl/core"
          xmlns:p="http://primefaces.prime.com.tr/ui">
        <ui:insert name="head">
            <h:head>
                <meta http-equiv="content-type" content="application/xhtml+xml;charset=utf-8" />
                <link rel="stylesheet" type="text/css" href="#{facesContext.externalContext.requestContextPath}/css/style.css" />
                <title></title>
            </h:head>
        </ui:insert>
        <h:body>
            <div class="main">
                <div class="main-bg">
                    <div class="main-width">
                        <div class="indent">
                            <h:form id="urlForm" prependId="false">
                                <div class="posturlbox">
                                    <h:inputText value="#{addUrlBean.userUrl}" styleClass="posturlinput" id="url" onclick="this.value = ''" />
                                </div>
                                <p:commandButton styleClass="button" action="#{addUrlBean.addVideo}" value="#{msg.send}" style="float: left;" update="urlForm" />
                                <div class="addUrlMessage">
                                    <p:message for="url" showSummary="true" showDetail="false" />
                                </div>
                            </h:form>
                            <div class="clear"></div>
                        </div>
                        <div class="content">
                            <div class="content-indent">
                                <ui:insert name="content">
                                </ui:insert>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </h:body>
    </html>
    test.xhtml
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:c="http://java.sun.com/jsp/jstl/core"
          xmlns:p="http://primefaces.prime.com.tr/ui">
        <h:head>
            <meta http-equiv="content-type"
                  content="application/xhtml+xml;charset=utf-8" />
        </h:head>
        <h:body>
            <ui:composition template="/WEB-INF/template/mainTemplate.xhtml">
            </ui:composition>
        </h:body>
    </html>
    addUrlManagedBean.java
    package managedBeans;
    import entities.UserEntity;
    import infoBeans.VideoValidationInfo;
    import javax.ejb.EJB;
    import javax.faces.application.FacesMessage;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.ManagedProperty;
    import javax.faces.bean.ViewScoped;
    import sessionBeans.VideoSessionBean;
    @ManagedBean(name = "addUrlBean")
    @ViewScoped
    public class AddUrlManagedBean extends GeneralManagedBean {
        @EJB
        VideoSessionBean videoSessionBean;
        private String userUrl = "URL";
        @ManagedProperty("#{loginBean}")
        LoginManagedBean loginMB;
        /** Creates a new instance of AddUrlManagedBean */
        public AddUrlManagedBean() {
        public void addVideo() {
            UserEntity sessionUser = loginMB.getSessionUser();
            if (sessionUser == null) {
                informUser(FacesMessage.SEVERITY_WARN,
                        "log_in_or_crate_new_account",
                        "log_in_or_crate_new_account_detail", "url");
            } else {
                int validationId = videoSessionBean.validateVideo(userUrl);
                if (validationId == VideoValidationInfo.VIDEO_IS_OK) {
                    videoSessionBean.addVideo(sessionUser, userUrl);
                    informUser(FacesMessage.SEVERITY_INFO,
                            "video_create_success",
                            "video_create_success_detail", "url");
                } else if (validationId == VideoValidationInfo.URL_IS_EMPTY) {
                    informUser(FacesMessage.SEVERITY_ERROR,
                            "url_is_empty",
                            "url_is_empty_detail", "url");
                } else if (validationId == VideoValidationInfo.URL_SYNTAX_WRONG) {
                    informUser(FacesMessage.SEVERITY_ERROR,
                            "url_syntax_wrong",
                            "url_syntax_wrong_detail", "url");
                } else if (validationId == VideoValidationInfo.VIDEO_NOT_EXIST) {
                    informUser(FacesMessage.SEVERITY_ERROR,
                            "video_not_exist",
                            "video_not_exist_detail", "url");
                } else if (validationId == VideoValidationInfo.VIDEO_ALREADY_EXIST) {
                    informUser(FacesMessage.SEVERITY_ERROR,
                            "video_already_exist",
                            "video_already_exist_detail", "url");
                } else if (validationId == VideoValidationInfo.VIDEO_ID_LENGTH_WRONG) {
                    informUser(FacesMessage.SEVERITY_ERROR,
                            "video_id_length_wrong",
                            "video_id_length_wrongdetail", "url");
            userUrl = "";
        public String getUserUrl() {
            return userUrl;
        public void setUserUrl(String userUrl) {
            this.userUrl = userUrl;
        public LoginManagedBean getLoginMB() {
            return loginMB;
        public void setLoginMB(LoginManagedBean loginMB) {
            this.loginMB = loginMB;
    }Now. if i click the Button
    *<p:commandButton styleClass="button" action="#{addUrlBean.addVideo}" value="#{msg.send}" style="float: left;" update="urlForm" />*
    *<div class="addUrlMessage">*
    it should only use the AddUrlManagedBean right (i tried it with h:commandButton too.. same result)? But i make a System.out in my other ManagedBeans (PostConstructs) and i see this logfile.
    LogFile
    INFO: PostConstruct: VideoDetailMB - ViewScoped
    INFO: PostConstruct: VideoMB - RequestScoped
    INFO: PostConstruct: UserVideosMB - ViewScopedHow is that possible? Why it activate the Lifecycle of other ManagedBeans?

    it should only use the AddUrlManagedBean rightWrong. It should also use this bean:
    @EJB
        VideoSessionBean videoSessionBean;with whatever consequences that has.

  • 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

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

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

Maybe you are looking for

  • SAP and Database Encrption on SQL Server 2005 or 2008

    Hi.  I searched as best I could for any existing threads on this topic, and could not find any, so I hope it's OK to raise a new one. We're running SAP ECC 6.0 on a SQL 2005 database.  Database size is around 3.3 TB, with Trans Log of about 550GB, st

  • How to get the number of processor license

    Hi, SQL> select CPU_COUNT_CURRENT,CPU_CORE_COUNT_CURRENT,CPU_COUNT_HIGHWATER,CPU_CORE_COUNT_HIGHWATER,CPU_SOCKET_COUNT_HIGHWATER 2 from v$license; CPU_COUNT_CURRENT CPU_CORE_COUNT_CURRENT CPU_COUNT_HIGHWATER CPU_CORE_COUNT_HIGHWATER CPU_SOCKET_COUNT_

  • CLASSPATH problem, deploying JSP app without right to modify classpath...

    I want to deploy a JSP web app to apache server with JRun for running JSP, but I don't have the permission to copy the required library files to the classpath, nor modify the classpath to append my application's path. Is there any way to workaround?

  • J2SDK 1.4.0 beta on Solaris 2.5.1

    I've downloaded and installed 1.4 beta, but it doesn't work on the Solaris 2.5.1 machine: % java -version Error: failed /disk/usr/j2sdk1_4_0b/jre/lib/sparc/client/libjvm.so, because ld.so.1: /disk/usr/j2sdk1_4_0b/bin/../bin/sparc/native_threads/java:

  • How to capture screen and consult captures

    Just wondering how to capture my desktop as a snapshot, and where do I find it after ?