Dynamic managed bean names
Hi!!
in my application i make code that must be present in every JSP pages. For that, i put it into a separated JSP page who is included in the other JSP (using <jsp:include> tag).
My problem is that each JSP who include the repetitive JSP, uses a different managed bean name.
For example, the page who is included is:
<f:subview id="navigation">
<h:inputText value="#{name-of-bean.navigation}" styleClass="inputNav" readonly="true" />
</f:subview>When this code is included into the pages, each page must use a different "name-of-bean".
I try with:
<jsp:include page="navigation.jsp">
<jsp:param name="beanName" value="AlfaBean" />
</jsp:include>and in the child JSP:
<h:inputText value="#{requestScope[param.beanName].navigation}"
styleClass="inputNav" readonly="true" />but dont work.
I try with:
<h:inputText value="#{resources[param.beanName].navigation}"
styleClass="inputNav" readonly="true" />but dont work.
Some body can help me??
PD: Sorry my bad english!!
JSF creates a managed bean at the time when firstly it evaluates the
corresponding value binding expression, such as "#{AlfaBean.someProp}".
Your JSP files include no expression including the name of the bean.
Although it may be a very tricky code, here is a sample used for you problem:<h:outputText value="" rendered="#{AlfaBean.someProp != null}"/>
<jsp:include page="navigation.jsp">
<jsp:param name="beanName" value="AlfaBean" />
</jsp:include>
Similar Messages
-
Managed Bean "Name" Access with in the Managed Bean
Hi,
I have faces-config.xml in which I have registered a managed bean
and I have a base class for all the managed bean.
The JSP's invoke the action/method defined in the base bean and I want to remove the managed bean from session upon a particular event.
To remove the managed bean from session, as far as I know - we need to know the managed-bean-name in the faces config.
I wanted to know if there is any way to get the name of the managed bean in the faces-config.xml at run time?.
Thanks,Thanks for your recommendations. The issue that I get stuck on is how to call this method that retrives employee data. When I had the code in the constructor, it executed when I accessed the view.jsp page. Then I populated the fields from the Employee class fields. But once I create non-constructor method, how do I invoke it from my JSF page.
-
Get Managed bean name while running tests.
hi,
while running web application,i can able get managed name.
but how to get managed bean name while running unit tests.
thanks
sivapublic String getManagedBeanName() {
String managedBeanName = null;
HttpServletRequest request =
(HttpServletRequest) FacesContext
.getCurrentInstance()
.getExternalContext()
.getRequest();
// lookup bean in request scope
Enumeration requestAttributeNames = request.getAttributeNames();
while (requestAttributeNames.hasMoreElements()) {
String requestAttribute = (String) requestAttributeNames.nextElement();
Object object = request.getAttribute(requestAttribute);
if (object instanceof MyBean) {
managedBeanName = requestAttribute;
break;
if (managedBeanName == null) {
// lookup bean in session scope
Enumeration sessionAttributeNames = request.getSession().getAttributeNames();
while (sessionAttributeNames.hasMoreElements()) {
String sessionAttribute = (String) sessionAttributeNames.nextElement();
Object object = request.getSession().getAttribute(sessionAttribute);
if (object instanceof MyBean) {
managedBeanName = sessionAttribute;
break;
return managedBeanName;
}Sorry, don't know other ways. -
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.
-
Dynamic Declarative Component managed bean returned null
Hi,
In a project from an application a DDC component is defined. This component uses a managed/backing bean with view scope.
Using this component inside this project is working fine. This component should be used in other view controller projects, and here where the problems are.
This project(let's call it Common) is deployed as ADF Library jar, and used in the other V-C projects.
The big problem is that the managed bean defined for the logic of this component is not 'reacheable'.
(Another problem is that the attribute value is not seen as its EL expression but as string, for this i found a workaround.)
In project Common the adfc-config.xml file:
<adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
<managed-bean id="__4">
<managed-bean-name id="__2">ExtendedShuttle</managed-bean-name>
<managed-bean-class id="__1">com.xyz.portal.taskflow.common.extendedshuttle.ExtendedShuttle</managed-bean-class>
<managed-bean-scope id="__3">view</managed-bean-scope>
</managed-bean>
</adfc-config>A part from component declaration:
<af:table var="row" rowBandingInterval="0" id="ta"
rowSelection="multiple" columnStretching="last"
disableColumnReordering="true" fetchSize="-1"
binding="#{viewScope.ExtendedShuttle.allItemsTable}"
value="#{viewScope.ExtendedShuttle.allModel}"
partialTriggers="::dc_cb5 ::dc_cb3"
filterVisible="true"/>The root exception is :
javax.el.PropertyNotFoundException: Target Unreachable, 'ExtendedShuttle' returned null
This exception is throw on com.sun.faces.application.ApplicationImpl.createComponent when *#{viewScope.ExtendedShuttle.allItemsTable}* is evaluated.
Caused By: javax.faces.FacesException: javax.el.PropertyNotFoundException: Target Unreachable, 'ExtendedShuttle' returned null
at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:262)
at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:222)
at javax.faces.webapp.UIComponentClassicTagBase.createFacet(UIComponentClassicTagBase.java:510)
at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:661)
at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1142)
at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.doStartTag(UIXComponentELTag.java:70)
at oracle.adfinternal.view.faces.taglib.UIXTableTag.doStartTag(UIXTableTag.java:41)
at oracle.adfinternal.view.faces.unified.taglib.data.UnifiedTableTag.doStartTag(UnifiedTableTag.java:50)
at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:50)
Caused By: javax.faces.FacesException: javax.el.PropertyNotFoundException: Target Unreachable, 'ExtendedShuttle' returned null
at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:262)
at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:222)
at javax.faces.webapp.UIComponentClassicTagBase.createFacet(UIComponentClassicTagBase.java:510)
at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:661)
at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1142)
at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.doStartTag(UIXComponentELTag.java:70)
at oracle.adfinternal.view.faces.taglib.UIXTableTag.doStartTag(UIXTableTag.java:41)
at oracle.adfinternal.view.faces.unified.taglib.data.UnifiedTableTag.doStartTag(UnifiedTableTag.java:50)
at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:50)
Caused by: javax.el.PropertyNotFoundException: Target Unreachable, 'ExtendedShuttle' returned null
at com.sun.el.parser.AstValue.getTarget(AstValue.java:88)
at com.sun.el.parser.AstValue.setValue(AstValue.java:133)
at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:255)
at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:259)
Can you help figure it out, why is not working or why the managed bean is not visible in other projects but only in the one where the component is defined?
Thank you for your time,
Bogdan
ps: how can i format the source code, on this fourm?Hi Frank,
Thank you for the answer.
I must say i'm quite new with ADF technology and maybe my questions are silly.
Here is a Quote from "Oracle Fusion Developer Guide - Building Rich Internet Application with Oracle ADF" by Frank Nimphius and Lynn Munsinger Chapter 15 page 498:
"You build dynamic declarative components *instead* of tag library based declarative components, if component resuse is required *only within the application* that has the component defined."
Maybe i misunderstand the meaning of application from this sentence, but i need this component in several ViewController projects from only one application (ADF application).
Tag lib declarative component I would not like to have, since the (automtically) build process is not my responsability and it will take some time till is pinpointed, but still is a last resort.
Anyway two things are strange:
1. Why the component is still available in other projects(and the beans not)?
2. Why when a binding variable (for example: of type FaceCtrlHierBinding) has the correct type in the declarative project and in the order projects is of type String and its value is the variable name?
Example:
<af:declarativeComponent ...
AllItems="#{bindings.Action}"
In project where the component is declared its value is an instance of FacesCtrlHierBinding and in the rest of the projects is of type String with value "Action".
Once again thank you a lot,
Bogdan -
I created a managed bean (ss.LoginBean) to play with some different login routines. I then used this bean as a field for SessionBean1. Things tested fine... but after a bit, the loginBean was no longer available for binding (although it was sill visible in SessionBean1) and this showed up in the managed-beans.xml file:
<managed-bean>
<managed-bean-name>LoginBean</managed-bean-name>
<managed-bean-class>ss.LoginBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>ss$LoginBean</managed-bean-name>
<managed-bean-class>ss.LoginBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
Now the fields that were bound to the loginBean values inside of SessionBean1 are painted red, and I am getting a startup error message of loginBean in the status line (lower left)
Anyone else see this? Where do I fix it?
haroldJust for completeness sake, I've dumped the log, from startup, through the first of 6 similiar error messages:
Log Session: Friday, August 6, 2004 2:08:05 PM PDT
System Info: Product Version = Java Studio Creator (Build 040621)
Operating System = Windows XP version 5.1 running on x86
Java; VM; Vendor = 1.4.2_04; Java HotSpot(TM) Client VM 1.4.2_04-b05; Sun Microsystems Inc.
Java Home = C:\Sun\Creator\java\jre
System Locale; Encod. = en_US; Cp1252
Home Dir; Current Dir = C:\Documents and Settings\Harold; C:\Sun\Creator\bin
IDE Install; User Dir = C:\Sun\Creator; C:\Documents and Settings\Harold\.Creator\1_0
CLASSPATH = C:\Sun\Creator\lib\ext\boot.jar;C:\Sun\Creator\lib\ext\jgraph.jar;C:\Sun\Creator\lib\ext\naming.jar;C:\Sun\Creator\lib\ext\pbclient.jar;C:\Sun\Creator\lib\ext\pbtools.jar;C:\Sun\Creator\lib\ext\rowset.jar;C:\Sun\Creator\lib\ext\smbase.jar;C:\Sun\Creator\lib\ext\smdb2.jar;C:\Sun\Creator\lib\ext\sminformix.jar;C:\Sun\Creator\lib\ext\smoracle.jar;C:\Sun\Creator\lib\ext\smresource.jar;C:\Sun\Creator\lib\ext\smsqlserver.jar;C:\Sun\Creator\lib\ext\smsybase.jar;C:\Sun\Creator\lib\ext\smutil.jar;C:\Sun\Creator\lib\ext\sql.jar;C:\Sun\Creator\lib\ext\sqlx.jar;C:\Sun\Creator\java\lib\dt.jar;C:\Sun\Creator\java\lib\tools.jar
Boot & ext classpath = C:\Sun\Creator\java\jre\lib\rt.jar;C:\Sun\Creator\java\jre\lib\i18n.jar;C:\Sun\Creator\java\jre\lib\sunrsasign.jar;C:\Sun\Creator\java\jre\lib\jsse.jar;C:\Sun\Creator\java\jre\lib\jce.jar;C:\Sun\Creator\java\jre\lib\charsets.jar;C:\Sun\Creator\java\jre\classes;C:\Sun\Creator\java\jre\lib\ext\dnsns.jar;C:\Sun\Creator\java\jre\lib\ext\ldapsec.jar;C:\Sun\Creator\java\jre\lib\ext\localedata.jar;C:\Sun\Creator\java\jre\lib\ext\sunjce_provider.jar
Dynamic classpath = C:\Sun\Creator\lib\core.jar;C:\Sun\Creator\lib\openfile-cli.jar;C:\Sun\Creator\lib\openide-loaders.jar;C:\Sun\Creator\lib\openide.jar;C:\Sun\Creator\lib\ravelnf.jar
[org.netbeans.core.modules #4] Warning: the extension C:\Sun\Creator\modules\ext\sac.jar may be multiply loaded by modules: [C:\Sun\Creator\modules\css.jar, C:\Sun\Creator\modules\insync.jar]; see: http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/classpath.html#class-path
Turning on modules:
org.openide/1 [4.26.1 040621]
org.openide.src [1.1.1 040621]
org.netbeans.modules.schema2beans/1 [1.7.1 040621]
org.netbeans.libs.j2eeeditor/1 [1.1.1 040621]
org.openide.loaders [4.11.1 040621]
org.openide.io [1.1.1 040621]
org.openide.execution [1.1.1 040621]
org.openide.compiler [1.2.1 040621]
org.netbeans.core/1 [1.21.1 040621]
org.netbeans.lib.terminalemulator [1.1.1 040621]
org.netbeans.core.output/1 [1.1.1 040621]
org.netbeans.core.compiler/1 [1.4.1 040621]
org.netbeans.modules.javahelp/1 [2.1.1 040621]
org.netbeans.api.java/1 [1.3.1 040621]
org.netbeans.core.execution/1 [1.3.1 040621]
org.netbeans.libs.xerces/1 [1.4.1 2.6.0]
org.apache.tools.ant.module/3 [3.6.1 040621]
org.openide.debugger [1.1.1 040621]
org.netbeans.modules.j2eeapis/1 [1.0 040621]
org.netbeans.modules.settings/1 [1.4.1 040621]
org.netbeans.api.xml/1 [1.3.1.3.6.0 3.6.0 040621]
org.netbeans.modules.debugger.core/3 [2.10.1 040621]
org.netbeans.modules.j2eeserver/3 [1.1.2 040701_4]
org.netbeans.modules.debugger.jpda/1 [1.17.1 040621]
org.netbeans.api.web.dd/1 [1.1.1 1.0 040621]
com.sun.rave.project/1 [1.0.1 040701_4]
com.sun.rave.jsfsupport/1 [1.0.1 040701_4]
org.netbeans.modules.editor/1 [1.14.2 040701_4]
com.sun.rave.insync/1 [1.0.1 040701_4]
org.netbeans.modules.diff/1 [1.7.1 040621]
com.sun.rave.jsfmetadata/1 [1.0 040621]
com.sun.rave.toolbox/1 [1.0.1 040701_4]
org.netbeans.modules.classfile/1 [1.8 040621]
org.netbeans.modules.java/1 [1.16.1 040621]
com.sun.rave.designer/1 [1.0.1 040701_4]
com.sun.rave.navigation/1 [1.0.1 040701_4]
org.netbeans.modules.servletapi24/1 [2.0.1 2.0.1 040621]
org.netbeans.core.ui/1 [1.3.1 040621]
org.netbeans.modules.beans/1 [1.11.1 040621]
com.sun.rave.layoutmgr/1 [1.1 040621]
com.sun.rave.plaf/1 [0.1 040621]
com.sun.rave.windowmgr/1 [1.1 040621]
com.sun.rave.jwsdpsupport/1 [1.0 040621]
org.netbeans.modules.schema2beansdev/1 [1.1.1 040621]
com.sun.rave.sam/1 [1.0.1 040701_4]
com.sun.rave.websvc/1 [1.0.1 040701_4]
org.netbeans.modules.image/1 [1.11.1 040621]
com.sun.rave.servernav/1 [1.0 040621]
org.netbeans.modules.properties/1 [1.11.1 040621]
org.netbeans.modules.properties.syntax/1 [1.11 040621]
org.netbeans.modules.html/1 [1.12.1 040621]
org.netbeans.modules.text/1 [1.12.1 040621]
org.openidex.util/2 [2.7.1 040621]
org.netbeans.modules.utilities/1 [1.15.1 040621]
com.sun.rave.licensemgr/1 [1.2 040621]
org.netbeans.modules.autoupdate/1 [2.8.1 040621]
com.sun.rave.raveupdate/1 [1.0.1 040621]
org.netbeans.modules.web.jspparser/2 [2.0.1 040621]
org.netbeans.modules.xml.core/2 [1.1.1.3.6.0 3.6.0 040621]
org.netbeans.modules.xml.text/2 [1.1.1.3.6.0 3.6.0 040621]
org.netbeans.modules.web.core.syntax/1 [1.13.1 040621]
com.sun.rave.jspsyntaxint/1 [1.0 040621]
com.sun.rave.welcome/1 [1.0 040621]
org.netbeans.modules.xml.catalog/2 [1.1.1.3.6.0 3.6.0 040621]
com.sun.tools.appserver/1 [2.0 20040621-1109]
org.netbeans.modules.clazz/1 [1.13.1 040621]
com.sun.rave.dataconnectivity/1 [1.0.1 040701_4]
org.netbeans.modules.css/2 [1.1.1.3.6.0 3.6.0 040621]
org.netbeans.core.ide/1 [1.3.1 040621]
com.sun.rave.errorhandler.server/1 [0.1 040621]
org.netbeans.modules.extbrowser/1 [1.3.1 040621]
*********** Exception occurred ************ at Fri Aug 06 14:09:18 PDT 2004
javax.faces.el.PropertyNotFoundException: loginBean
at com.sun.rave.jsfsupp.container.Beans2PropertyResolver.getValue(Unknown Source)
at com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:167)
at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:151)
at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)
at com.sun.faces.el.ValueBindingImpl.getValue(Unknown Source)
at com.sun.faces.el.ValueBindingImpl.getValue(Unknown Source)
at javax.faces.component.UIOutput.getValue(UIOutput.java:147)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:82)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:191)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:169)
[catch] at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:712)
at com.sun.rave.insync.faces.FacesPageUnit.renderBean(Unknown Source)
at com.sun.rave.insync.faces.FacesPageUnit.renderNode(Unknown Source)
at com.sun.rave.insync.faces.FacesPageUnit.renderBean(Unknown Source)
at com.sun.rave.insync.faces.FacesPageUnit.getFacesRenderTree(Unknown Source)
at com.sun.rave.css2.FacesSupport.getFacesHtml(Unknown Source)
at com.sun.rave.css2.CssContainerBox.addNode(Unknown Source)
at com.sun.rave.css2.CssContainerBox.createChildren(Unknown Source)
at com.sun.rave.css2.DocumentBox.createChildren(Unknown Source)
at com.sun.rave.css2.DocumentBox.relayout(Unknown Source)
at com.sun.rave.css2.PageBox.layout(Unknown Source)
at com.sun.rave.css2.PageBox.paint(Unknown Source)
at com.sun.rave.css2.PageBox.paint(Unknown Source)
at com.sun.rave.designer.DesignerPaneUI.paintSafely(Unknown Source)
at com.sun.rave.designer.DesignerPaneUI.paint(Unknown Source)
at com.sun.rave.designer.DesignerPaneUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(JComponent.java:541)
at com.sun.rave.designer.DesignerPane.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(JComponent.java:808)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JViewport.paint(JViewport.java:722)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at com.sun.winsys.layout.impl.DnDPanel.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at com.sun.winsys.layout.impl.DnDPanel.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JSplitPane.paintChildren(JSplitPane.java:1021)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4787)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4740)
at javax.swing.JComponent._paintImmediately(JComponent.java:4685)
at javax.swing.JComponent.paintImmediately(JComponent.java:4488)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
INFORMATIONAL *********** Exception occurred ************ at Fri Aug 06 14:09:18 PDT 2004
Annotation: Component HTML encoding error
javax.faces.el.PropertyNotFoundException: loginBean
....repeated 5 times
harold -
Session scope managed bean is not instantiating?
We have the need to use a session bean (rather than pageFlowScope) in our application. But it looks like the session beans are not being instantiated at run time like other beans are. I created a simple test case to verify. One bean, named "MySessionBean", defined in the task flow as Session scope, then referenced in a view with an input text box, value: #{sessionScope.MySessionBean.value1}. When I run the application, I just get PropertyNotFoundException, Target Unreachable, 'MySessionBean' returned null.
If I simply change the bean to use pageFlowScope, everything works fine. I have debug code in the bean constructor, and it never gets called. Is there some other step I am missing to have ADF instantiate the session bean?No luck, I tried it in both adfc-config.xml, and faces-config.xml. I also tried moving the call to my view, from my bounded taskflow, into the adfc-config unbounded task flow, and then I ran that instead. Still got the same error. Here is my code from the the last round of tests with the view called in the main adfc-config.xml unbounded taskflow:
adfc-config.xml:
<?xml version="1.0" encoding="windows-1252" ?>
<adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
<view id="testView">
<page>/testView.jspx</page>
</view>
<managed-bean id="__2">
<managed-bean-name id="__5">MySessionBean</managed-bean-name>
<managed-bean-class id="__4">test.MySessionBean</managed-bean-class>
<managed-bean-scope id="__3">session</managed-bean-scope>
</managed-bean>
</adfc-config>
testView.jspx:
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1">
<af:form id="f1">
<af:inputText label="Label 1" id="it1"
value="#{sessionScope.MySessionBean.value1}"/>
</af:form>
</af:document>
</f:view>
</jsp:root>
MySessionBean.java:
package test;
public class MySessionBean {
private String value1="Hello World";
public MySessionBean() {
super();
public void setValue1(String value1) {
this.value1 = value1;
public String getValue1() {
return value1; -
Action / actionListener in h:commandButton with managed beans
I have a problem with a backing bean whose method is not invoked when i click it. I've seen some posts on here about this yet, I still don't understand what I am doing wrong, if anything.
Some context...I've modeled my application after 'jcatalog' from this article:
http://www.javaworld.com/javaworld/jw-07-2004/jw-0719-jsf.html . It's simpler than the article -- I'm not using Spring/Hibernate and the persistence is the file system. For each business object (Resource), there's a backing bean (ResourceBean).
In short, I can't get the backing bean to respond to the button event for 'Add' bound to addAction. This is just like the jcatalog 'createProduct' impl -- which doesn't use the (FacesEvent fe ) approach.
Anyway, I would appreciate anyone's help to get past this.
-Lorinda
(Below are the codes...)
Here's my beans-config.xml:
<!-- view -->
<managed-bean>
<description>
Managed bean that is used as an application scope cache
</description>
<managed-bean-name>applicationBean</managed-bean-name>
<managed-bean-class>
com.intalio.qa.tcm.view.beans.ApplicationBean
</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
<managed-property>
<property-name>viewServicesManager</property-name>
<value>#{viewServicesManagerBean}</value>
</managed-property>
</managed-bean>
<managed-bean>
<description>
View service manager impl for business services
</description>
<managed-bean-name>viewServicesManagerBean</managed-bean-name>
<managed-bean-class>
com.intalio.qa.tcm.view.beans.ViewServicesManagerBean
</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<managed-bean>
<description>
Backing bean that contains product information.
</description>
<managed-bean-name>resourceBean</managed-bean-name>
<managed-bean-class>
com.intalio.qa.tcm.view.beans.ResourceBean
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
(Note, the applicationBean uses view services manager. The manager is used by the ResourceBean. (It's initialized by the h:output dummy variable reference at the top of my .jsp page)). I can see the initialization in the debug trace.
Here's the resource bean:
import java.util.ArrayList;
import java.util.List;
import javax.faces.FacesException;
import javax.faces.model.SelectItem;
import com.intalio.qa.exceptions.DuplicateIdException;
import com.intalio.qa.exceptions.TCMException;
import com.intalio.qa.tcm.model.Resource;
import com.intalio.qa.tcm.view.builders.ResourceBuilder;
import com.intalio.qa.tcm.view.util.FacesUtils;
* Resource backing bean.
public class ResourceBean extends RootBean {
* The Resource id
private String id;
* The Resource name
private String name;
* Description
private String description;
* the resource type id associated with the Resource
private String resourceTypeId;
// the resource type id associated with the Resource
private List resourceTypeIds;
* @return Returns the resourceTypeIds.
public List getResourceTypeIds() {
return resourceTypeIds;
* @param resourceTypeIds The resourceTypeIds to set.
public void setResourceTypeIds(List resourceTypeIds) {
this.resourceTypeIds = resourceTypeIds;
* Default constructor.
public ResourceBean() {
super();
init();
* Initializes ResourceBean.
* @see RootBean#init()
protected void init() {
try {
LOG.info("ResourceBean init()");
if (id != null) {
Resource resource = viewServicesManager.getResourceService().getResourceById(id);
ResourceBuilder.populateResourceBean(this, resource);
} catch (TCMException ce) {
String msg = "Could not retrieve Resource with id of " + id;
LOG.info(msg, ce);
throw new FacesException(msg, ce);
* Backing bean action to update Resource.
* @return the navigation result
public String updateAction() {
LOG.info("updateAction is invoked");
try {
// Resource Resource = ResourceBuilder.createResource(this);
// LOG.info("ResourceId = " + Resource.getId());
// viewServicesManager.getResourceService().updateResource(Resource);
//remove the ResourceList inside the cache
//FacesUtils.resetManagedBean(BeanNames.RESOURCE_LIST_BEAN);
} catch (Exception e) {
String msg = "Could not update Resource";
LOG.error(msg, e);
FacesUtils.addErrorMessage(msg + ": Internal Error.");
return NavigationResults.FAILURE;
LOG.info("Resource with id of " + id + " was updated successfully.");
return NavigationResults.SUCCESS;
* Backing bean action to create a new Resource.
* @return the navigation result
public String addAction() {
LOG.info("addAction is invoked");
try {
Resource resource = ResourceBuilder.createResource(this);
LOG.info("between");
viewServicesManager.getResourceService().saveResource(resource);
} catch (DuplicateIdException de) {
String msg = "This id already exists";
LOG.info(msg);
FacesUtils.addErrorMessage(msg);
return NavigationResults.RETRY;
} catch (Exception e) {
String msg = "Could not save Resource";
LOG.error(msg, e);
FacesUtils.addErrorMessage(msg + ": Internal Error");
return NavigationResults.FAILURE;
String msg = "Resource with id of " + id + " was created successfully.";
LOG.info(msg);
return NavigationResults.SUCCESS;
* Backing bean action to delete Resource.
* @return the navigation result
public String deleteAction() {
LOG.info("deleteAction is invoked");
try {
// Resource Resource = ResourceBuilder.createResource(this);
// viewServicesManager.getResourceService().deleteResource(Resource);
//remove the ResourceList inside the cache
// FacesUtils.resetManagedBean(BeanNames.RESOURCE_LIST_BEAN);
} catch (Exception e) {
String msg = "Could not delete Resource. ";
LOG.error(msg, e);
FacesUtils.addErrorMessage(null, msg + "Internal Error.");
return NavigationResults.FAILURE;
String msg = "Resource with id of " + id + " was deleted successfully.";
LOG.info(msg);
FacesUtils.addInfoMessage(msg);
return NavigationResults.SUCCESS;
public String getId() {
return id;
* Invoked by the JSF managed bean facility.
* <p>
* The id is from the request parameter.
* If the id is not null, by using the id as the key,
* the Resource bean is initialized.
* @param newQueryId the query id from request parameter
public void setId(String newId) {
id = newId;
public String getName() {
return name;
public void setName(String newName) {
name = newName;
public String getDescription() {
return description;
public void setDescription(String newDescription) {
description = newDescription;
public String getResourceTypeId() {
return resourceTypeId;
public void setResourceTypeId(String newResourceTypeId) {
resourceTypeId = newResourceTypeId;
public String toString() {
return "id=" + id + " name=" + name;
Here's the jsp:
<f:subview id="resourcesCombinedView_subview">
<h:form id="createResourceForm" target="dataFrame">
<h:outputText value="#{applicationBean.dummyVariable}" rendered="true" />
<div align="center">
<head>
<link href="../../css/stylesheet.css" rel="stylesheet" type="text/css">
<FONT color="#191970" size="4" face="Arial">Resources View</FONT>
</head>
<table style="margin-top: 2%" width="35%" cellpadding="10">
<div align="left">
<FONT color="#191970" size="3" face="Arial">Update Resources </FONT>
</div>
<tr>
<td align="center" valign="top" align="center" style="" bgcolor="white" />
<table>
<tbody>
<tr>
<td align="left" styleClass="header" width="100" />
<td align="left" width="450"/>
</tr>
<tr>
<td align="right" width="100"><h:outputText value="Id" /></td>
<td align="left" width="450"><h:inputText
value="#{resourceBean.id}" id="id" required="true" /> <h:message
for="id" styleClass="errorMessage" /></td>
</tr>
<tr>
<td align="right" width="100"><h:outputText value="Name" /></td>
<td align="left" width="450"><h:inputText
value="#{resourceBean.name}" id="name" required="true" /> <h:message
for="name" styleClass="errorMessage" /></td>
</tr>
<tr>
<td align="right" width="100" valign="bottom"><h:outputText
value="Type" /></td>
<td align="left" width="550">
<h:selectOneMenu
value="#{resourceBean.resourceTypeId}" id="resourceTypeId">
<f:selectItem itemValue="" itemLabel="Select Resource Type" />
<f:selectItem itemValue="database" itemLabel="Database" />
<f:selectItem itemValue="external application"
itemLabel="External Application" />
<f:selectItem itemValue="internal"
itemLabel="Intalio|n3 Products" />
<f:selectItem itemValue="os" itemLabel="Operating System" />
</h:selectOneMenu> <h:outputText
value="#{resourceBean.resourceTypeId}" /> <h:message
for="resourceTypeId" styleClass="errorMessage" /></td>
</tr>
<tr>
<td align="right" width="100" valign="bottom"><h:outputText
value="Description" /></td>
<td align="left" width="450"><h:inputText
value="#{resourceBean.description}" id="description" size="96" />
<h:message for="description" styleClass="errorMessage" /></td>
</tr>
</tbody>
</table>
</h:form></td>
<!-- END DATA FORM -->
<!-- BEGIN COMMANDS -->
<td width="30%" align="left" valign="top"><h:form
id="buttonCommandsForm">
<h:panelGroup id="buttons">
<h:panelGrid columns="1" cellspacing="1" cellpadding="2"
border="0" bgcolor="white">
<h:commandButton value="Add"
style="height:21px; width:51px;font-size:8pt; font-color: black;"
actionListener="#{resourceBean.addAction}">
</h:commandButton>
<h:commandButton id="deleteCB" value="Delete"
style="height:21px; width:51px;font-size:8pt"
action="#{resourceBean.deleteAction}">
</h:commandButton>
<h:commandButton id="spaceFillerButton" tabindex="-1"
style="height:21px; width:51px;font-size:8pt;background-color: #ffffff;color: #ffffff;border: 0px;">
</h:commandButton>
<h:commandButton id="saveCB" value="Save"
style="height:21px; width:51px;font-size:8pt"
actionListener="#{resourceBean.saveAction}">
</h:commandButton>
<h:commandButton id="updateCB" value="Update"
style="height:21px; width:51px;font-size:8pt"
actionListener="#{resourceBean.updateAction}">
</h:commandButton>
</h:panelGrid>
</h:panelGroup>
</h:form> <!-- end buttons --></td>
</tr>
</table>
<HR align="center" size="2" width="60%" />
<!-- data table --></div>
</f:subview>Hey, anyway, have you note your jsp reference to the backing bean begins with a lowercase letter, and your backing bean class name begins with an uppercase letter?? I think that's it... I think, cause I'm too unexperienced in JSF.... Bye!!
-
Managed bean returns null on SetActionListener
Hi,
I'm trying to implement a filter for my table (something similar to what's done in the "OracleAS 10g R3: Oracle ADF for Forms/4GL Developers/Volume II" student guide, practice 9-5). The idea is to have a request-scoped managed bean which holds the filter value - the value is set using a SetActionListener, and later bound to a bind variable in a view with a view criteria. I have problem re-creating this in Trinidad (JDev 11 TP3, to be exact).
I have created a request-scoped bean in adfc-config.xml (called 'ecnStatusBean'), with a managed property (named 'Status'). I am referencing it from my SetActionListener: setting #{'E'} to #{requestScope.ecnStatusBean.Status}. The reference compiles fine in the Expression Builder (it didn't before I created the managed bean), but when running and clicking the CommandLink with the SetActionListener, I get a runtime error:
oracle.security.jazn.JAZNRuntimeException: Target Unreachable, 'ecnStatusBean' returned null
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:480)
To make things more interesting, I tried changing the scope to session, and got a different error:
oracle.adf.controller.ControllerException: ADFC-10001: Cannot instantiate class 'pelephone.cdma_ecn.ecn_manager.model.ecnStatusMB'.
at oracle.adfinternal.controller.util.Utils.createAndLogFacesException(Utils.java:169)
Am I doing a rookie's mistake? Is this a Trinidad issue? Something else?
Thanks in advance for any help,
BorisAre you sure about the reference you use here: #{requestScope.ecnStatusBean.Status}.
Here is a simple sample of what works for me:
The first page has this:
<af:form binding="#{backing_start.form1}" id="form1">
<af:inputText label="Label 1" binding="#{backing_start.inputText1}"
id="inputText1"/>
<af:commandButton text="commandButton 1"
binding="#{backing_start.commandButton1}"
id="commandButton1" action="go">
<af:setActionListener from="#{backing_start.inputText1.value}"
to="#{backing_start.paramToPass}"/>
</af:commandButton>
</af:form>It references a bean that has this:
private RichInputText inputText1;
public void setInputText1(RichInputText inputText1) {
this.inputText1 = inputText1;
public RichInputText getInputText1() {
return inputText1;
public String paramToPass;
public void setParamToPass(String paramToPass) {
this.paramToPass = paramToPass;
public String getParamToPass() {
return paramToPass;
}And then I can see it in the next page that I navigated to like this:
<af:outputText value="the current value is #{backing_start.paramToPass}"/>In the adf-config.xml I have this:
<adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
<view id="start">
<page>/start.jspx</page>
</view>
<view id="end">
<page>/end.jspx</page>
</view>
<control-flow-rule>
<from-activity-id>start</from-activity-id>
<control-flow-case>
<from-outcome>go</from-outcome>
<to-activity-id>end</to-activity-id>
</control-flow-case>
</control-flow-rule>
<managed-bean>
<managed-bean-name>backing_start</managed-bean-name>
<managed-bean-class>backing.backing_start</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</adfc-config> -
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.
-LI 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 -
Get the current value of a managed bean.
Hi guys
I have a register page which takes the Login ID and the password and retype password whose values are stored in the "Managed Beans" in registerServer.java.
I have a (PwdValidator.java) Custom validator for Re-type Password which validates itself against the password.
Now my problem is from the PwdValidator.java how can I access the value of the password which is stored in the managed bean in registerServer.java.
here is a copy of my faces-config.xml
<managed-bean>
<managed-bean-name>registerServer</managed-bean-name>
<managed-bean-class>com.sun.registerServer</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
Help is really appreciated,
Thanks,
Chaprasi BabaThanks for the reply but my question is how do I get
the password value from the managed bean
FacesContext context =
FacesContext.getCurrentInstance();
Application application = context.getApplication();
CountryValueObject registerServer =
(CountryValueObject)application.getVariableResolver().r
solveVariable(context, "registerServer");
String pwd = registerServer.password // So will this
give me the current value for that session.You didn't go far enough in replacing the example code . Try this:
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
RegisterServer registerServer = (RegisterServer)application.getVariableResolver().resolveVariable(context, "registerServer");
String pwd = registerServer.password // So will this give me the current value for that session. -
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 moreThank 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. -
ADF Faces: How to get the ADF BindingContainer in a managed bean?
Hi,
I not sure how to get the BindingContainer instance from inside of a managed bean method. I have tried the following config, but it does not work in all situations.
<managed-bean>
<managed-bean-name>backing_showBooks</managed-bean-name>
<managed-bean-class>view.backing.ShowBooks</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>bindingContainer</property-name>
<property-class>oracle.adf.model.binding.DCBindingContainer</property-class>
<value>#{bindings}</value>
</managed-property>
<!--oracle-jdev-comment:managed-bean-jsp-link:1showBooks.jsp-->
</managed-bean>When an ActionListener- method of my ShowBooks bean is called the property bindingContainer is NULL!!
Is there a save way to get the BindingContainer in my bean??
Any hints are welcome.
Thanks,
MarkusMaybe I just need another pair of eyes but when I set this up as explained and watch it in the debugger my method public void setBindingContainer(DCBindingContainer bc) gets called but bc is null. Can anyone help?
Thanks
Backing Bean-
private DCBindingContainer bindingContainer;
public void setBindingContainer(DCBindingContainer bc) {
this.bindingContainer = bc;
public DCBindingContainer getBindings() {
return bindingContainer;
//I just threw this method on there in case I was missing something & I also
//tried using a getBindingContainer method above but that didn;t work.
public void setBindings(DCBindingContainer bindings) {
this.bindingContainer = bindings;
adf-faces.conf entry
<managed-bean>
<managed-bean-name>backing_VunerabilityDetail</managed-bean-name>
<managed-bean-class>viewcontroller.backing.VunerabilityDetail</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>bindingContainer</property-name>
<property-class>oracle.adf.model.binding.DCBindingContainer</property-class>
<value>#{bindings}</value>
</managed-property>
<!--oracle-jdev-comment:managed-bean-jsp-link:1VunerabilityDetail.jsp-->
</managed-bean> -
Can't get JSF to access managed bean methods from web page
I'm using NetBeans 6.7.1 and Glassfish v2.1
Having problems here can somebody please help? It is really
frustrating because I have written apps like this before in fact I
used one as a model to create an even simpler app and still can't get
it to work. I ran it through the debugger and it stops in the
constructor so it looks like the bean object is being created, but the
setUid method and the testit method are not being entered when I click
on the enter commandbutton. Can somebody PLEASE give me an idea as to
what might be going on? I am totally stumped and this is holding up
some important work I need to get done. Any help would be greatly
appreciated:
web.xml:
- Show quoted text -
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/welcomeJSF.jsp</welcome-file>
</welcome-file-list>
</web-app>
faces-config.xml:
<?xml version='1.0' encoding='UTF-8'?>
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
<managed-bean>
<managed-bean-name>testbean</managed-bean-name>
<managed-bean-class>com.lingosys.quoteest.testbean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/go.jsp</from-view-id>
<navigation-case>
<from-outcome>correct</from-outcome>
<to-view-id>/ok.jsp</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
</faces-config>
go.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%--
This file is an entry point for JavaServer Faces application.
--%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>JSP Page</title>
</head>
<body>
<f:view>
<h1>JAS Generator</h1>
<p/>
<h:form id="testForm" enctype="multipart/form-data" >
<p/>Both fields are required.
<p/>Enter Test ID: <h:inputText id="pid"
value="#{testbean.uid}" required="true"/>
<p/><h:commandButton value="Enter"
action="#{testbean.testit}"/>
</h:form>
</f:view>
</body>
</html>
testbean.java:
* To change this template, choose Tools | Templates
* and open the template in the editor.
package com.lingosys.quoteest;
* @author mphoenix
public class testbean {
private String uid;
public testbean() {
int x=0;
public String getUid() {
return uid;
public void setUid(String uid) {
this.uid = uid;
public String testit() {
return "correct";
}MikePhoenix wrote:
enctype="multipart/form-data"
Why?
Oh, in the future please post code in code blocks. Use the CODE button to get them. Use the Preview tab to see if anything went right. -
Can't set managed bean property:
Hi,
I am trying to experiment with JSF and I am extending an example I downloaded from the web. When I added a new secret field and extened the bean. I get the following error. I trying to resolve this problem from two days , cant figure out why I get this exception. I tried changed the property name I still get the same error. It is something to do with the bean, I am not sure why its not able to set the property, I know that the get and set methods exist in the class file. Any help would be greatly appreciated . I have pasted the bean file, faces-config.xml, and the inputname.jsp file below. Thanks a lot.
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: javax.faces.FacesException: javax.faces.FacesException: Can't set managed bean property: 'word'.
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:430)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:48)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Thread.java:536)
root cause
javax.servlet.ServletException: javax.faces.FacesException: javax.faces.FacesException: Can't set managed bean property: 'word'.
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:531)
at org.apache.jsp.inputname_jsp._jspService(inputname_jsp.java:94)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:430)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:48)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Thread.java:536)
My JSP file is
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:loadBundle basename="demo.bundle.Messages" var="Message"/>
<HTML>
<HEAD> <title>Input Name Page</title> </HEAD>
<body bgcolor="white">
<f:view>
<h1><h:outputText value="#{Message.inputname_header}"/></h1>
<h:messages style="color: red"/>
<h:form id="helloForm" >
<h:outputText value="#{Message.prompt}"/>
<h:inputText id="userName" value="#{GetNameBean.userName}" required="true">
<f:validateLength minimum="2" maximum="10"/>
</h:inputText>
<h:inputSecret id="word" value="#{GetNameBean.word}" required="true">
<f:validateLength minimum="2" maximum="10"/>
</h:inputSecret>
<h:commandButton id="submit" action="sayhello" value="Say Hello" />
</h:form>
</f:view>
</HTML>
My faces-config.xml is as follow
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<navigation-rule>
<from-view-id>/inputname.jsp</from-view-id>
<navigation-case>
<to-view-id>/greeting.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<description>
Input Value Holder
</description>
<managed-bean-name>GetNameBean</managed-bean-name>
<managed-bean-class>demo.GetNameBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>userName</property-name>
<property-class>java.lang.String</property-class>
<value></value>
</managed-property>
<managed-property>
<property-name>word</property-name>
<property-class>java.lang.String</property-class>
<value></value>
</managed-property>
</managed-bean>
</faces-config>
My bean file is as follows GetNameBean.java
package demo;
* @author Sergey Smirnov. Exadel, Inc.
public class GetNameBean {
private String userName;
private String word;
* @return User Name
public String getUserName() {
return userName;
* @param User Name
public void setUserName(String name) {
this.userName = name;
* @return Password
public String getWord() {
return word;
* @param Password
public void setWord(String word) {
this.word = word;Hello,
Thanks for the reply. I used Camelcase, but its giving me the same error. I am also posting my bean files and jsp files for your reference.
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: org.apache.jasper.JasperException: javax.faces.FacesException: javax.faces.FacesException: Can't set managed bean property: 'UserName'.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
javax.faces.FacesException: org.apache.jasper.JasperException: javax.faces.FacesException: javax.faces.FacesException: Can't set managed bean property: 'UserName'.
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:327)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.
LOGIN.JSP file
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<f:view>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<f:verbatim escape="false">
<head>
<title>My JSP 'login.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
</f:verbatim>
<body>
<h:form rendered="true" id="loginform">
<f:verbatim escape="false"><br><br> </f:verbatim>
<h:outputLabel for="userName" rendered="true"></h:outputLabel>
<h:inputText id="userName" required="true" rendered="true" value="#{UserBean.userName}"></h:inputText>
<f:verbatim escape="false"><br> </f:verbatim>
<h:outputLabel for="password" rendered="true"></h:outputLabel>
<h:inputSecret id="password" redisplay="false" required="true" rendered="true" value="#{UserBean.password}"></h:inputSecret>
<h:commandButton id="submit" action="#{UserBean.loginUser}" rendered="true" value=" Submit"></h:commandButton><br><br></h:form>
</body>
</html>
</f:view>
UserBean file
package com.jsfdemo.bean;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
* @author ExterroAdmin
public final class UserBean extends Object
private String password;
private String userName;
public UserBean()
super();
public String getPassword()
return password;
public void setPassword(String password)
this.password = password;
public String getUserName()
return userName;
public void setUserName(String userName)
this.userName = userName;
public String loginUser() {
if("myeclipse".equals(getUserName()) && "myeclipse".equals(getPassword()))
return "success";
FacesContext facesContext = FacesContext.getCurrentInstance();
FacesMessage facesMessage = new FacesMessage(
"You have entered an invalid user name and/or password");
facesContext.addMessage("loginForm", facesMessage);
return "failure";
If you need any more information, please let me know
Maybe you are looking for
-
Problems syncing yahoo contacts to ipod touch Model MB5286 Version 4.2.1
For the last 2 years I have had no trouble updating my yahoo contacts to my ipod touch. I just plugged in my ipod and away it went. More recently, the iTunes format appears to have changed and I no longer see the same iPod information menus as befo
-
SAP R/3 to MII - Format of Input Data
Hi, Can I send data in XML format when doing a webservice call from SAP R/3 to MII? I will probably have 2 columns and upto 100 rows of data in each call. Regards, Chanti.
-
Reading attachments via Javamail gives ? characters
Hi, I'm using Javamail to read messages in a mailbox and to save the attachments that are on those messages. Some attachments are HTML documents that seem to contain bullet characters (doing a View Source on the HTML still shows the bullet, not "<li>
-
I do not want iOS to update itself automatically, does it do this?
I am new to the iPhone, and iOS. I have an iPhone 4s running iOS 5.0.1 I hear 5.0.2 is coming out any day now. As a Mac user I always like to wait after an update is released to read the feedback. Will iOS update itself automatically? If so how do I
-
1) I have created a BEX Master Data Query on 0MATERIAL. The Material Master Object also has a text table associated with it called /BI0/TMATERIAL. It has text in French and in English. We also have the "Language Dependent" box checked on the 0Mate