You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Elam Daly <el...@gmail.com> on 2005/11/21 16:53:08 UTC
Rendered Property: Simple Test ( Try Again! )
Howdy all,
I'm trying to do something very simple. I have an <outputText> component set
as <outputText value="Here I am" rendered="#{TestBean.renderMe}" />
The TestBean is simple as well:
public class TestBean {
int i = 0;
public boolean renderMe() {
if( i%2 == 0 ) return true;
else return false;
}
}
I'm just trying to set the render state programmaticly, yet Tomcat keeps
throwing this:
javax.faces.FacesException: Bean: com.whiteware.beans.TestBean,
property: rendStatus
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:422)
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView
(JspViewHandlerImpl.java:234)
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter
(ExtensionsFilter.java:123)
In fact, if I try to use any bean method at all, it always fails. Even
something as simple as 'return true' etc.
Any help would be appreciated,
Elam
Re: Rendered Property: Simple Test ( Try Again! )
Posted by Marius Kreis <ma...@nulldevice.org>.
Howdy.
Have you defined your Bean in the faces-config.xml?
It should look like:
<managed-bean>
<managed-bean-name>testBean</managed-bean-name>
<managed-bean-class>yourPackage.TestBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
Elam Daly wrote:
> Howdy all,
>
> I'm trying to do something very simple. I have an <outputText>
> component set as <outputText value="Here I am"
> rendered="#{TestBean.renderMe}" />
>
> The TestBean is simple as well:
>
> public class TestBean {
>
> int i = 0;
>
> public boolean renderMe() {
> if( i%2 == 0 ) return true;
> else return false;
> }
> }
>
> I'm just trying to set the render state programmaticly, yet Tomcat keeps
> throwing this:
>
> javax.faces.FacesException: Bean: com.whiteware.beans.TestBean, property: rendStatus
> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:422)
> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView
>
> (JspViewHandlerImpl.java:234)
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter
>
> (ExtensionsFilter.java:123)
>
> In fact, if I try to use any bean method at all, it always fails. Even
> something as simple as 'return true' etc.
>
> Any help would be appreciated,
> Elam
Re: Rendered Property: Simple Test ( Try Again! )
Posted by Peter Maas <pf...@gmail.com>.
Eeuhm,
i think 'renderMe' does not qualify as a typical javabean method. I think
you should stick to the get/set/is paradigm:
public class TestBean{
String a = "test";
public String getA(){
return(a);
}
public boolean getRenderMe(){
return(true);
}
}
and after this access the values using:
#{testBean.renderMe} or #{testBean.a}
of coarse the name of the bean you are referring to needs to be defined in
the faces config.
regards,
-P
the method
On 11/21/05, Elam Daly <el...@gmail.com> wrote:
>
> Howdy all,
>
> I'm trying to do something very simple. I have an <outputText> component
> set as <outputText value="Here I am" rendered="#{TestBean.renderMe}" />
>
> The TestBean is simple as well:
>
> public class TestBean {
>
> int i = 0;
>
> public boolean renderMe() {
> if( i%2 == 0 ) return true;
> else return false;
> }
> }
>
> I'm just trying to set the render state programmaticly, yet Tomcat keeps
> throwing this:
>
> javax.faces.FacesException: Bean: com.whiteware.beans.TestBean, property: rendStatus
> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:422)
> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView
>
> (JspViewHandlerImpl.java:234)
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter
>
> (ExtensionsFilter.java:123)
>
> In fact, if I try to use any bean method at all, it always fails. Even
> something as simple as 'return true' etc.
>
> Any help would be appreciated,
> Elam
>
Re: Rendered Property: Simple Test ( Try Again! )
Posted by Bruno Aranda <br...@gmail.com>.
Can you post your jsp code? I think the exception is not because of
what you think. In the exception it says that there is a rendStatus
property in your page that is not behaving well. Could you post the
stackTrace from the server (localhost-***.log)?
Regards,
Bruno
2005/11/21, Elam Daly <el...@gmail.com>:
> Howdy all,
>
> I'm trying to do something very simple. I have an <outputText> component
> set as <outputText value="Here I am" rendered="#{TestBean.renderMe}" />
>
> The TestBean is simple as well:
>
> public class TestBean {
>
> int i = 0;
>
> public boolean renderMe() {
> if( i%2 == 0 ) return true;
> else return false;
> }
> }
>
> I'm just trying to set the render state programmaticly, yet Tomcat keeps
> throwing this:
> javax.faces.FacesException: Bean: com.whiteware.beans.TestBean, property:
> rendStatus
> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:422)
> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView
>
> (JspViewHandlerImpl.java:234)
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter
>
> (ExtensionsFilter.java:123)
> In fact, if I try to use any bean method at all, it always fails. Even
> something as simple as 'return true' etc.
>
> Any help would be appreciated,
> Elam
>
Re: Rendered Property: Simple Test ( Try Again! )
Posted by Elam Daly <el...@gmail.com>.
Thanks for the replies everyone. It was indeed how my method was named,
although I could have swore at one point I had it named correctly.
Oh well. It's maddening how such a simple mistake can cost you hours.
Thanks again.
RE: Rendered Property: Simple Test ( Try Again! )
Posted by Mariano Petrakovsky <mp...@tecnonexo.com>.
You must be defined your managed bean into your faces-config.xml
Like this:
<managed-bean>
<managed-bean-name>testBean</managed-bean-name>
<managed-bean-class>
com.mypackage.TestBean
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
And in your jsp:
<outputText value="Here I am" rendered="#{testBean.renderMe}" />
And in your Bean:
public class TestBean {
int i = 0;
public boolean isRenderMe() {
if( i%2 == 0 ) return true;
else return false;
}
}
Try ! :)
--
Mariano G. Petrakovsky
Programmer · Software Factory
AXG Tecnonexo - www.tecnonexo.com
Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
Argentina.
Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.
Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
Tel.: (202) 986-7541 - Fax: (202) 787-3891.
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · ·
-----Mensaje original-----
De: Elam Daly [mailto:elam.daly@gmail.com]
Enviado el: Lunes, 21 de Noviembre de 2005 12:53
Para: users@myfaces.apache.org
Asunto: Rendered Property: Simple Test ( Try Again! )
Howdy all,
I'm trying to do something very simple. I have an <outputText> component
set as <outputText value="Here I am" rendered="#{TestBean.renderMe}" />
The TestBean is simple as well:
public class TestBean {
int i = 0;
public boolean renderMe() {
if( i%2 == 0 ) return true;
else return false;
}
}
I'm just trying to set the render state programmaticly, yet Tomcat keeps
throwing this:
javax.faces.FacesException: Bean: com.whiteware.beans.TestBean, property:
rendStatus
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(Servl
etExternalContextImpl.java:422)
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView
(JspViewHandlerImpl.java:234)
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter
(ExtensionsFilter.java:123)In fact, if I try to use any bean method at all,
it always fails. Even something as simple as 'return true' etc.
Any help would be appreciated,
Elam