Problems setting managed bean property of type Integer

I got a problem when I use valueBinding #{param.productId} in faces-config.xml for my managed bean:
My property 'productId' in bean Product is of type Integer, and my bean is in request scope. When I try to invoke some action on page, wich should navigate me to another view - JSF is trying to set productId for current view, and of course it is empty (""), and for the reasons given above I'm getting an error:
javax.faces.FacesException: Can't set managed bean property: 'applicationId'.
at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:576)
at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:233)
at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:256)
... 60 more
Caused by: java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:489)
at java.lang.Integer.<init>(Integer.java:609)
at com.sun.faces.config.ManagedBeanFactory.getConvertedValueConsideringPrimitives(ManagedBeanFactory.java:855)
at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:555)
Should I use requestScope instead of param to have my parameter null, and not "" ?
If so, how should I pass requestScope parameter using commandLink?

Hi! I have a problem with setting params too. Probably my one is different.
I have a jsp page which show a datatable, where I can see a row for each Product. If I click on its name I would navigate to another page that shows product informations, as several ecommerce sites do.
But I can't understand what and how I must set to inform the details page on which product have to show.
I read in this forum that it's possible to set a parameter in productBean, and then the constructor of product bean loads others fields knowing its id.
The snippet of my faces-config.xml is:
  <managed-bean>
    <managed-bean-name>product</managed-bean-name>
    <managed-bean-class>test.backing.ProductBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
      <property-name>idToLoad</property-name>
      <property-class>java.lang.Integer</property-class>
      <value>#{param.id}</value>
    </managed-property>
  </managed-bean>It is possible? is a correct solution? and if it is, how can I do that?
Thanks very much if someone can resolve my problem.
Claudio.

Similar Messages

  • 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

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • H:selectOneMenu value binding to managed bean property

    Please help. Cannot figure out why selectOneMenu value binding is not working...
    The main contents of my jsp:
         <h:form id="form1" rendered="true">
              <P>
                   <h:selectOneMenu value="#{MBListBoxExample.selectedProject}" rendered="true"
                        required="false">
                        <f:selectItems value="#{MBListBoxExample.items}" />
                   </h:selectOneMenu>
              </P>
              <h:commandButton value="ShowSelected" rendered="true" action="#{MBListBoxExample.showSelected}" />
         </h:form>I have a managed bean with a property that is basically a custom object:
    private Project selectedProject;The selectOneMenu gets populated with the following code in my managed bean:
         public List getItems() {
              try {
                   ArrayList projectList = new ArrayList ();
                   projectList.add(new Project(1, "Project 1"));
                   projectList.add(new Project(2, "Project 2"));
                   projectList.add(new Project(3, "Project 3"));
                   projectList.add(new Project(4, "Project 4"));
                   ArrayList itemList = new ArrayList();
                   for (int x=0; x<projectList.size(); x++) {
                        SelectItem tempItem = new SelectItem();
                        Project tempProj = (Project) projectList.get(x);
                        tempItem.setLabel(tempProj.getName());
                        tempItem.setValue(tempProj);
                        itemList.add(tempItem);
                   return itemList;
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              return null;
         }The following code is tied to my command button to display some simple output when the button is clicked:
         public void showSelected() {
              System.out.println("The selected item is: " + selectedProject.getName());
         }If I set the value of the SelectItem (tempItem) above to a String and make the selectedProject variable of type String, the code works.
    My goal is to have the items in the list reference 'Project' objects and be able to get to the selected object when the user clicks the command button.
    Any help is greatly appreciated.

    The problem is that you're missing a converter. JSF needs to convert your values from Strings into Projects and vica verca.
    When you do the form submission the values are passed as strings along with the labels. JSF isn't smart enough to convert them automatically.

  • Urgent - can't set managed bean value using a form, getting null

    I have a form with a bean -- unbelievably, I can't get the values entered into the form by the user to get stored into the bean. Everything is null... I've looked at a zillion examples, posts and compared etc...yet still can't see what is missing.
    Here's part of a trace :
    [cc]Dec-31 01:25:02 ApplicationImpl - Created bean resourceBean successfully
    [cc]Dec-31 01:25:02 ApplicationImpl - Storing resourceBean in scope request
    [cc]Dec-31 01:25:02 VariableResolverImpl - resolveVariable: Resolved variable:id=null name=null
    [cc]Dec-31 01:25:02 ValueBindingImpl - getValue Result:id=null name=null
    [cc]Dec-31 01:25:02 ValueBindingImpl - -->Returning id=null name=null
    If you have any ideas, please let me know--it seems just as I solve one JSF issue, I run into another on unexpectedly simple things.
    Here's the ResourceBean.java, the bean-config.xml and my jsp.
    package com.intalio.qa.tcm.view.beans;
    import java.util.Map;
    import javax.faces.context.FacesContext;
    import javax.faces.model.SelectItem;
    import org.apache.log4j.Logger;
    import com.intalio.qa.exceptions.DuplicateIdException;
    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 {
         * Class logger
         public static final Logger LOG =
              Logger.getLogger(ResourceBean.class);
    * The Resource id
         private String id = null;
         * The Resource name
         private String name = null;
    * Description
    private String description= null;
         * the resource type id associated with the Resource
         private String resourceTypeId= null;
         private static SelectItem[] resourceTypeIds = new SelectItem[] {
              new SelectItem("External Software"),
              new SelectItem("Hardware"),
              new SelectItem("Intalio Product Software"),
              new SelectItem("Machine - Dual CPU"),
              new SelectItem("Machine - CPU Single"),
              new SelectItem("Memory - UNIX"),
              new SelectItem("Memory - Windows") };
    * @return Returns the resourceTypeIds.
    public SelectItem[] getResourceTypeIds() {
    return resourceTypeIds;
    * @param resourceTypeIds The resourceTypeIds to set.
    public void setResourceTypeIds(SelectItem[] typeIds) {
    resourceTypeIds = typeIds;
         * Default constructor.
         public ResourceBean() {
    super();
    init();
         * Initializes ResourceBean.
         * @see RootBean#init()
         protected void init() {
         /*True, but I'd strongly recommend instead using:
    FacesContext fContext = FacesContext.getCurrentInstance();
    Map requestParams = fContext.getExternalContext().getRequestParameterMap();
    String companyId = (String) requestParams.get("companyID");
    The getRequest(), getSession(), and getContext() methods of ExternalContext should only be used as a last resort.*/
         * 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);
              } catch (Exception e) {
                   String msg = "Could not update Resource";
                   LOG.error(msg, e);
                   FacesUtils.addErrorMessage(msg + ": Internal Error.");
                   return ActionResult.FAILURE;
              LOG.info("Resource with id of " + id + " was updated successfully.");
              return ActionResult.SUCCESS;
         * Backing bean action to create a new Resource.
         * @return the navigation result
         public String addAction() {
              try {
                   Resource resource = ResourceBuilder.createResource(this);
    LOG.info("resource created: " + resource.getName() + " with typeId = " + resource.getResourceTypeId());
                   viewServicesManager.getResourceService().saveResource(resource);
              } catch (DuplicateIdException de) {
                   String msg = "This id already exists";
                   LOG.info(msg);
                   FacesUtils.addErrorMessage(msg);
                   return ActionResult.RETRY;
              } catch (Exception e) {
                   String msg = "Could not save Resource";
                   LOG.error(msg, e);
                   FacesUtils.addErrorMessage(msg + ": Internal Error");
                   return ActionResult.FAILURE;
              String msg = "Resource with id of " + id + " was created successfully.";
              LOG.info(msg);
              return ActionResult.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 ActionResult.FAILURE;
              String msg = "Resource with id of " + id + " was deleted successfully.";
              LOG.info(msg);
              FacesUtils.addInfoMessage(msg);
              return ActionResult.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) {
              LOG.info("setId " + 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;
         <!-- view -->
         <managed-bean>
              <description>
                   Managed bean
              </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>request</managed-bean-scope>
              <managed-property>
                   <property-name>viewServicesManager</property-name>
                   <value>#{viewServicesManagerBean}</value>
              </managed-property>
         </managed-bean>
    </faces-config>
    <f:view>
         <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"/> <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" /> <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>
                                            <f:selectItems value="#{resourceBean.resourceTypeIds}" />
                                       </h:selectOneMenu> <h:outputText value="#{resourceBean.resourceTypeId}" id="dresourceTypeId" /> <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;" action="#{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" 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" action="#{resourceBean.saveAction}">
                        </h:commandButton>
                        <h:commandButton id="updateCB" value="Update" style="height:21px; width:51px;font-size:8pt" action="#{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:view>
    THANKS.
    -L

    I solved this.
    Since I was testing the action code only, I didn't define a navigation entry corresponding to the action string returned for this button:
    <h:commandButton value="Add" style="height:21px; width:51px;font-size:8pt; font-color: black;" action="#{resourceBean.addAction}">
    </h:commandButton>After I added a nav definition, it worked. I don't know why at this point. I suspect a key step in the lifecycle was pre-empted...someone else can probably explain why. If I get a chance to research it after I'm done with my project, I'll update this post.
    Thanks.
    -L

  • Bug/Bad docs trying to bind SelectItem to bean property of type Collection

    Hi,
    I've been trying for the best part of the morning to use a selectOneMenu tag and bind the selectItems value to a backing bean property.
    The tutorial states that:
    "The advantages of using the selectItems tag are as follows:
    You can represent the items using different data structures, including Array, Map, List, and Collection. The data structure is composed of SelectItem instances or SelectItemGroup instances."
    well I've used Map, and List (which are both covered by Collection anyway...) and they don't work. You go silently to the renderResponse phase.
    In all cases the content of my Collection typed property were javax.faces.model.SelectItem instances.
    I changed the backing bean property to be of type SelectItem[] instead and suddenly it works fine.
    It's as if the binding mechanism isn't able to handle collections?
    Is the tutorial wrong or does this just not work?
    I'm using 1.0.
    Neil

    Hi
    I have the same problem whereby my backing beans has implemented as a HashSet of attachments for a client. If this is changed to a type, List say ArrayList, everything works correctly with no errors.
    client.attachments -> contains a HashSet of attachments
    Page goes to display this list and if a Set is used then error below is thrown.
    Has anyone experienced this problem and found a solution, it would very help
    Thanks
    Glenn
    Exception :
    com.sun.facelets.tag.TagAttributeException: /C:/development/42508/apmweb/pages/client/client_notes_list.xhtml @70,53 tes
    t="${not empty note.attachments}" /C:/development/42508/apmweb/pages/client/client_notes_list.xhtml @70,53 test="${not e
    mpty note.attachments}": Bean: org.hibernate.collection.PersistentSortedSet, property: 0
    at com.sun.facelets.tag.TagAttribute.getObject(TagAttribute.java:235)
    at com.sun.facelets.tag.TagAttribute.getBoolean(TagAttribute.java:79)
    at com.sun.facelets.tag.jstl.core.IfHandler.apply(IfHandler.java:49)
    at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
    at com.sun.facelets.tag.jstl.core.ForEachHandler.apply(ForEachHandler.java:168)
    at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
    at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:147)
    at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
    at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:147)
    at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:147)
    at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
    at com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:94)
    at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
    at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
    at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
    at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
    at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:400)
    at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:434)
    at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:214)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:120)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3020)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1925)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1848)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1288)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    Caused by: javax.el.PropertyNotFoundException: /C:/development/42508/apmweb/pages/client/client_notes_list.xhtml @70,53
    test="${not empty note.attachments}": Bean: org.hibernate.collection.PersistentSortedSet, property: 0
    at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:73)
    at com.sun.facelets.tag.TagAttribute.getObject(TagAttribute.jav
    Code :
    <c:forEach items="#{WriteableClient.notes}" var="note">          
    <c:if test="#{not empty note.attachments}">
    </c:forEach >

  • Unable to access nested managed bean property in JSF 1.2.9

    In an old version of JSF, namely 1.2-b20-FCS from April/21/2006, I could access nested properties of a managed bean. So I had a managed bean OuterBean, and in JSF I could write
    <h:inputText value="#{outerBean.innerBean1.propertyA"/>
    The Java class OuterBean has a member function
    InnerBean OuterBean.getInnerBean1();
    That is, there is a function getInnerBean1() taking no arguments, and it returns something which in my example above is the class InnerBean.
    Class InnerBean has a member function getPropertyA().
    But in the latest JSF from July/17/2008, this nested stuff is not working.
    Simple access like #{outerBean.propertyA} works, but nested access like #{outerBean.innerBean.propertyA} does not.
    The exception is something like
    org.apache.jasper.el.JspELException: /whatever/mypage.jsp(71,15) '#{outerBean.innerBean.username}' Error reading 'innerBean' on type
    mypackage.OuterBean at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:107) at javax.faces.component.UIOutput.getValue(UIOutput.java:184) at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:284) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:154) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:946) at javax.faces.render.Renderer.encodeChildren(Renderer.java:148) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942) at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:271) at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:202) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:109) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) atThanks.

    Sorry, it looks fine to me. In my original post, I had the call stack in code and for some reasons the newlines were removed. So let me try again in text, but putting two newlines. Hope it works this time:
    org.apache.jasper.el.JspELException: /whateverr/mypage.jsp(71,15) '#{outerBean.innerBean.property}' Error reading 'innerBean' on type mypackage.OuterBean at
    org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:107) at javax.faces.component.UIOutput.getValue(UIOutput.java:184) at
    com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201) at
    com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:284) at
    com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:154) at
    javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861) at
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:946) at
    javax.faces.render.Renderer.encodeChildren(Renderer.java:148) at
    javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837) at
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:936) at
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:942) at
    com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:271) at
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:202) at
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:109)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) at
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) at
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) at
    Edited by: sn72 on Sep 21, 2008 10:21 AM
    Edited by: sn72 on Sep 21, 2008 10:22 AM

  • 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

  • Setting managed bean names dynamically

    I am trying to retrieve a sessionscoped managed bean ,set different values on it then save it on the same session using
    FacesContext fc = FacesContext.getCurrentInstance();
    ValueBinding vb = FacesContext.getCurrentInstance.getApplication.createValueBinding("#{sessionScope.user}");
    user currentuser = (user) vb.getValue(fc);
    I successfully retrieve the object,
    currentuser.setuser("james");
    but when i change fields on it then I cant save i get an IllegalStateException.
    vb.setValue(fc,currentuser);help please.

    okay ladies, here is the answer. the call to facescontext /getvalue/setvalue/ must be on the same thread ie not on separate methods.i.e fetch object on variable declaration, set object on constructor.

  • Accessing managed-beans property from simple java class

    I have managed bean that is registered in faces-config.xml:
    <managed-bean>
    <managed-bean-name>documentReportsBean</managed-bean-name>
    <managed-bean-class>[myApp].beans.DocumentReportsBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    I want to access property of documentReportsBean from other java class without registering managed-property in faces-config. How can I do that?

    Thank you, what I needed was someone saying the right word. "ValueBinding" in this case.. :)
    Two lines:
    ValueBinding vb = FacesContext.getCurrentInstance().getApplication().createValueBinding("#{documentReportsBean}");
    DocumentReportsBean pbean = (DocumentReportsBean) vb.getValue(FacesContext.getCurrentInstance());
    gives my full control. Nice

  • How to set Lov item property (Action type,event,parameter etc) in PR when page load

    Hi gurus
    I am new to OAF, First I need to explain my scenerio.
    I need to make some field mandatory or non mandatory based on one LOV item (Pick list or message choice list).
    for this i extended the controler and apply the changes, but in this case what heppen, It will effect only when i open the list (pop list) and click on more (Available in poplist) and it will open a new form and i select value from that form. But when I open the poplist and select the value from the same list rather going to more option (it does not open new form), then there are no effect. I though the issue with refreshing when selecting value from the same list.
    To resolving this issue what i did
    1. go to page == > the same LOV
    2. Change the Client Action properties (
         Action type  = fireAction
         event          = xxevent
        submit = true.
    After doing this when i run the page from my OAF enviroement , every thing is OK. Then I transfer the Controler to Server machine and change the controller and run the same page from the server, it has the same refreshing issue, Then I thought because I did not transfer LOV such properties so this is hepening,
    Now I want to initilize such properties in Page load or what I need to do, Please advise me.
    Regards,
    Haq

    Edward,
    Thank you for the suggestion! It directly lead to my solution wherein I used CASE statements for the column in my Region SELECT such as the following:
    WHEN (:P2_GRADING_METHOD = 'CR/NC' OR scs.scs_pass_audit = 'P') AND GET_GRADE_B93 (sac.stc_final_grade, sac.stc_verified_grade) IS NULL THEN htmldb_item.select_list_from_lov (5, 'Enter Grade', 'GRADE_LOV_CRNC','onBlur="return validate_grade(this,''FW_DATE_'||ROWNUM||''')"','NO',NULL,NULL,'GRADE_'||ROWNUM)
    When the column is NULL, the Select List (LOV) contains the entry 'Enter Grade' and that is the value displayed on page load. I bypass the value 'Enter Grade' during Submit Processing where database updating occurs.
    I did not find the need to enter values for p_null_value and p_null_text since I don't believe that it would cause the 'Enter Grade' value to display on page load for null value columns but rather would enable the user to select 'Enter Grade' from the list and have a specified return value stored in htmldb_item array.
    Again, thank you for the help!

  • Problems setting up PayPal as payment type

    I've tried this twice now, each time, I get to the point where I set up a Billing Agreement with PayPal, but when I click on Return to Merchant I get an error. If I go back to the iTunes store, it askes me again to update my information. Its like it doesn't know I've set up the Billling Agreement with PayPay. Any ideas?
    Thanks,
    Alfredo

    Hi Alfredo,
    If this page doesn't answer your question then use the form at the bottom of the page to get in touch with Apple:
    http://www.apple.com/support/itunes/store/paypal/
    Regards,
    Colin R.

  • 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

  • Getting error after when trying to print managed session bean property.

    Hi All,
    I am reading a file from my local machine. After reading a file , i am storing file details in the property of the same bean.
    After that i am trying to preint contents of that file in one jsp by accessing that stored managed bean property.
    But I am getting following error:
    Nov 15, 2009 2:33:41 PM com.sun.faces.lifecycle.LifecycleImpl phase
    WARNING: executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@138c63) threw exception
    javax.faces.FacesException
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:135)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
         at java.lang.Thread.run(Unknown Source)
    Caused by: ClientAbortException:  java.net.SocketException: Connection reset by peer: socket write error
         at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:319)
         at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:288)
         at org.apache.catalina.connector.Response.flushBuffer(Response.java:548)
         at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:279)
         at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:201)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
         ... 15 more
    Caused by: java.net.SocketException: Connection reset by peer: socket write error
         at java.net.SocketOutputStream.socketWrite0(Native Method)
         at java.net.SocketOutputStream.socketWrite(Unknown Source)
         at java.net.SocketOutputStream.write(Unknown Source)
         at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:740)
         at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
         at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:299)
         at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:973)
         at org.apache.coyote.Response.action(Response.java:183)
         at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:314)
         ... 20 more
    Nov 15, 2009 2:33:41 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet Faces Servlet threw exception
    java.net.SocketException: Connection reset by peer: socket write error
         at java.net.SocketOutputStream.socketWrite0(Native Method)
         at java.net.SocketOutputStream.socketWrite(Unknown Source)
         at java.net.SocketOutputStream.write(Unknown Source)
         at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:740)
         at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
         at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:299)
         at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:973)
         at org.apache.coyote.Response.action(Response.java:183)
         at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:314)
         at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:288)
         at org.apache.catalina.connector.Response.flushBuffer(Response.java:548)
         at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:279)
         at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:201)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
         at java.lang.Thread.run(Unknown Source)There is no specific reason mentioned for this error. Anyone has faced this problem before?
    Whats wrong here?

    Hi gimbal2,
    I haven't deployed the project yet. I am still in development phase. I am using eclipse. So i am using inbuilt browser from eclipse only.
    I saw this post on the same forum:
    http://forums.sun.com/thread.jspa?threadID=5297862
    This person had the same problem. But his question is not answered yet.
    People here are saying:
    *1)page is getting submitted more than once. Either because the user is clicking on the commandbuttons/links multiple times or through some other event.*
    ->I am not using any javascript. But problem here is whenever i try to load file from my local machine, in first attempt it wont proceed. I need to load file twice or thrice. Is it some problem?
    But one thing to note here is that i am not getting exception after loading the file. I am getting exception after reading the file in managed bean and returning from it with some status.
    *2)This exception can be caused by the browser closing its end of the socket for any number of reasons (user presses stop loading button, clicks another link, closes the browser window, etc.):*
    ->I am not pressing any button or doing any activity once i load the file.
    *3)Sounds like it should be caught and ignored since these are normal user actions. I was just concerned it might be causing some kind of impact that we don't know about.*
    ->I can't ignore it because, my next JSP is not getting loaded after i return from the read file bean.
    Hope People here can help me solve this problem. I am not able to proceed :(

  • ADFC bean property

    I am having problems settings a bean property in adfc-config.xml and getting the value in the bean class. When I access the property in the java bean, it has not been set, altho I have a value in adfc-config.
    Here are my code details:
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
    <managed-bean>
    <managed-bean-name>agProperties</managed-bean-name>
    <managed-bean-class>oracle.bpel.activityguide.ui.beans.model.AGProperties</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    <managed-property>
    <property-name>filename</property-name>
    <value>/scratch/cshare/cshare_eventpoc/atgpf/applcore/activityguide/activityguideApps/AGNonUIshellApp/ViewController/activityguide.properties</value>
    </managed-property>
    </managed-bean>
    </adfc-config>
    Java bean:
    package oracle.bpel.activityguide.ui.beans.model;
    public class AGProperties {
    private static String _AGPropertyFilename = "";
    public AGProperties() {
    /** this is set in adfc-config.xml
    * explicit path +filename
    public void setFilename(String filename) {
    _AGPropertyFilename = filename;
    public static void load() {
    propFileName = _AGPropertyFilename;  ///HERE THIS IS NOT SET from adfc-config.xml
    }

    Thanks for the quick response.
    I removed all static definitions from the java and changed the managed bean scope to "application",
    However it is still not getting the value set from adfc-config. (BTW: previously we were using a JAVA_OPTIONS parm on the application cmdline for the filepath and getting that thru the system settings in java code and it worked fine but we were told to use the adfc-config.xml instead for the file path info .)
    Maybe some of the details are the cause of the problem. The managed bean is in a deployed jar file. The application page is in a separately deployed workspace. I've set the managed bean info the adfc-config.xml of the application. (When I also had it in the jar file's adfc-config.xml the log complained of a duplicately defined managed bean, so I removed it from the jar's adfc-config file. )
    When the AGProperty.getProperty method is called, the managed bean property setFilename for AGProperties has still not been called & set yet with adfc-config value. I have set breakpoints in a debug session to verify this. These properties as used for EL values on the initally rendered jsf page fragment, which is included in a region as a task-flow on the main page.
    Is there another way to load this bean managed property directly in Java code from the adfc-config file ? Or iIs there another way to set a filepath for the properties file specific to the application other than using adfc-config.xml ?
    revised Java code:
    public class AGProperties {
    private String _AGPropertyFilename = "";
    public AGProperties() {
    /** this is set in adfc-config.xml
    * explicit path +filename
    public void setFilename(String filename) {  //never getting called
    _AGPropertyFilename = filename;
    adfc-config.xml
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
    <managed-bean>
    <managed-bean-name>agProperties</managed-bean-name>
    <managed-bean-class>oracle.bpel.activityguide.ui.beans.model.AGProperties</managed-bean-class>
    <managed-bean-scope>application</managed-bean-scope>
    <managed-property>
    <property-name>filename</property-name>
    <value>/scratch/cshare/cshare_eventpoc/atgpf/applcore/activityguide/activityguideApps/AGNonUIshellApp/ViewController/activityguide.properties</value>
    </managed-property>
    </managed-bean>
    </adfc-config>
    Edited by: user568107 on Feb 17, 2009 3:20 PM
    Edited by: user568107 on Feb 17, 2009 4:37 PM

Maybe you are looking for

  • How to determine column length semantics through ANSI Dynamic SQL ?

    I am looking for a way to determine the length semantics used for a column through ANSI Dynamic SQL. I have a database with NLS_CHARACTERSET=AL32UTF8. In this database I have the following table: T1(C1 varchar2(10 char), C2 varchar2(40 byte)) When I

  • Check distance (within a range) moved in y-axis?

    In my example below is there a way the code can check how far the numbers have moved in the y-axis so that eventually I can have a button that checks to see if the user has moved the numbers to a defined distance in the y-axis (within a range)? http:

  • How can i update ISO verson software in ipod touch (2G) 8GB

    how can i update ISO verson software in ipod touch (2G) 8GB?

  • Drawing the same shape different times.

    Hey, I'm trying to paint a mini map to the screen using following code:   protected void paintComponent(Graphics g) {     super.paintComponent(g);        Graphics2D g2 = (Graphics2D) g;     int row = 0, col = 0;     for (Tile t : map.getAllTiles()) {

  • How to build installer

    Hi, I have LabView 2014 and trying to build and installer from an existing vi. I encountered the attached error1. If I click OK or Build, it asks for media path (error2). I don't know what these mean and how to proceed. Any help is appreciated Thanks