You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by dr...@yahoo.com.br on 2005/10/19 23:09:32 UTC

JSF does not find managed bean

Hi, everyone. I'm learning JSF and I'm having some
headaches.

I have a managed bean called LogonBean with two String
attributes, login and password, their getters and
setters and a method called logon(). In the jsp I have
a commandButton that calls the logon method.

When I click the commandButton, logon() is never
called; instead, an error message "Conversion Error"
is displayed. As my attributes are both String and no
conversion is required, I put immediate="true" on the
button to skip validation/convertion. Then, this
exception was thrown:

------------------- 

18:16:01,859 ERROR [[Faces Servlet]] Servlet.service()
for servlet Faces Servlet threw exception
 javax.faces.FacesException: Error calling action
method of component with id logonForm:_id3
 	at
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
 	at 
[...]

Caused by: javax.faces.el.EvaluationException:
Exception while invoking expression #{logon.logon}
 	at
org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:165)
 	at
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
 	... 25 more

Caused by: javax.faces.el.PropertyNotFoundException:
Base is null: logon
 	at
org.apache.myfaces.el.ValueBindingImpl.resolveToBaseAndProperty(ValueBindingImpl.java:457)
 	at
org.apache.myfaces.el.MethodBindingImpl.resolveToBaseAndProperty(MethodBindingImpl.java:180)
 	at
org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:114)
 	... 26 more

------------------- 

I think that the managed bean is not being found, am I
right? Its declaration on faces-config.xml is like
this:

Code:

<managed-bean>
  <managed-bean-name>logon</managed-bean-name>
 
<managed-bean-class>br.com.advocacia.arq.faces.LogonBean</managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
</managed-bean>
 

And all my classes are in a file lib.jar which I
declared in application.xml:

Code:

 <application>
 	
  [...]
 	
 	<module>
 		<java>lib.jar</java>
 	</module>
 	
 </application>
 

Please, does anyone knows what is going wrong?



	



	
		
_______________________________________________________ 
Promoção Yahoo! Acesso Grátis: a cada hora navegada você acumula cupons e concorre a mais de 500 prêmios! Participe! http://yahoo.fbiz.com.br/

Re: JSF does not find managed bean

Posted by Rick Gruber-Riemer <ri...@vanosten.net>.
Sorry I meant "#[logon.senha]"

Rick Gruber-Riemer wrote:
> My guess would be that you used "|" (pipe character) instead of "["  
> => "[logon.senha]" instead of "|logon.senha]"
>
> Mike Kienenberger wrote:
>> <h:inputSecret id="senha"
>> value="#{logon.senha}"/>
>>
>>   private String password;
>>
>> I don't see anything beside the above inconsistency, but I'm pretty
>> sure that you just translated senha to password in your first message
>> so it'd be more clear.
>>
>> Try adding this to your form and see if you get better errors.
>>
>> <h:messages showDetail="true"/>
>>
>>
>> On 10/19/05, drvpspam-myfaces@yahoo.com.br
>> <dr...@yahoo.com.br> wrote:
>>  
>>> There is no conversion error stack trace.
>>>
>>> My jsp:
>>> -------------------
>>> <!doctype html public "-//w3c//dtd html 4.0
>>> transitional//en">
>>> <html>
>>> <head>
>>> <meta http-equiv="Content-Type" content="text/html;
>>> charset=iso-8859-1">
>>> <title>Teste - Login</title>
>>> <%@ taglib uri="http://java.sun.com/jsf/html"
>>> prefix="h" %>
>>> <%@ taglib uri="http://java.sun.com/jsf/core"
>>> prefix="f" %>
>>> </head>
>>>
>>> <body>
>>> <f:view>
>>>
>>> <h:form id="logonForm">
>>> <h:messages/>
>>>
>>> <h:outputText value="Login:"/>
>>> <h:inputText id="login" value="#{logon.login}"/><br/>
>>>
>>> <h:outputText value="Senha:"/>
>>> <h:inputSecret id="senha"
>>> value="#{logon.senha}"/><br/>
>>>
>>> <h:commandButton action="#{logon.logon}"
>>> value="Entrar"/>
>>>
>>> </h:form>
>>>
>>> </f:view>
>>> </body>
>>> </html>
>>> ---------------
>>>
>>> My faces-config.xml:
>>>
>>> ---------------
>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>> <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems,
>>> Inc.//DTD JavaServer Faces Config 1.0//EN"
>>>
>>> "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
>>> <faces-config>
>>>
>>>  <managed-bean>
>>>   <managed-bean-name>logon</managed-bean-name>
>>>
>>> <managed-bean-class>br.com.advocacia.arq.faces.LogonBean</managed-bean-class> 
>>>
>>>   <managed-bean-scope>request</managed-bean-scope>
>>>  </managed-bean>
>>>
>>>  <navigation-rule>
>>>
>>>   <from-view-id>/logon.jsp</from-view-id>
>>>
>>>   <navigation-case>
>>>    <from-outcome>sucesso</from-outcome>
>>>    <to-view-id>/menu.jsp</to-view-id>
>>>   </navigation-case>
>>>
>>>   <navigation-case>
>>>    <from-outcome>falha</from-outcome>
>>>    <to-view-id>/logon.jsp</to-view-id>
>>>   </navigation-case>
>>>
>>>  </navigation-rule>
>>>
>>> </faces-config>
>>> -------------------
>>>
>>> My web.xml:
>>>
>>> -------------------
>>>
>>> <web-app>
>>>  <display-name>Advocacia</display-name>
>>>  <description>Sistema de Advocacia</description>
>>>
>>>  <!-- Faces Servlet -->
>>>  <servlet>
>>>   <servlet-name>Faces Servlet</servlet-name>
>>> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>>>   <load-on-startup>1</load-on-startup>
>>>  </servlet>
>>>
>>>  <!-- Faces Servlet Mapping -->
>>>  <servlet-mapping>
>>>   <servlet-name>Faces Servlet</servlet-name>
>>>   <url-pattern>*.jsf</url-pattern>
>>>  </servlet-mapping>
>>>
>>>  <!-- Parameters -->
>>>  <context-param>
>>> <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>>>   <param-value>client</param-value>
>>>  </context-param>
>>>
>>>  <context-param>
>>> <param-name>javax.faces.application.CONFIG_FILES</param-name>
>>> <param-value>/WEB-INF/config/faces-config.xml</param-value>
>>>  </context-param>
>>>
>>> </web-app>
>>>
>>> -------------------
>>>
>>> LogonBean has two String attributes, login and senha
>>> with their getters and setters and a method public
>>> String logon().
>>>
>>> My application directory structure:
>>>
>>> app
>>> +-advocacia.ear
>>>   +- advocacia.war
>>>     +- WEB-INF
>>>        +- config
>>>           +- faces-config.xml
>>>        +- lib
>>>           +- application libs
>>>        +- web.xml
>>>     +- application jsps
>>>   +- arq.jar
>>>      +- EJB classes and descriptors
>>>   +- lib.jar
>>>      +- other classes
>>>   +- META-INF
>>>      +- application.xml
>>>
>>> I hope you can find the error... :)
>>>
>>> Thanks,
>>> David
>>>
>>> --- Mike Kienenberger <mk...@gmail.com> escreveu:
>>>
>>>    
>>>> There's not enough information to speculate why that
>>>> is happening.
>>>> You'll need to post the conversion error stack trace
>>>> (if there is one).
>>>>
>>>> You should probably also post your full jsp page and
>>>> full faces-config file.
>>>>       
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________________
>>> Promoção Yahoo! Acesso Grátis: a cada hora navegada você acumula 
>>> cupons e concorre a mais de 500 prêmios! Participe! 
>>> http://yahoo.fbiz.com.br/
>>>
>>>     
>>
>>   
>
>


Re: JSF does not find managed bean

Posted by dr...@yahoo.com.br.
Hi!

I don't think so... I'm pretty sure that the reason of
this conversion error is because the managed bean
(LogonBean) is null...  so when it tries to lookup for
its methods, a FacesException is thrown.

I'm saying this because I switched to the Sun RI to
see if it works, but the same conversion error
occurred and the exception said it! The exception was
"could not bound property logon to null bean logon" or
something like this. 

Do you know why can this be happening? This is driving
me crazy! 

David

--- Mike 
--- Rick Gruber-Riemer <ri...@vanosten.net> escreveu:

> My guess would be that you used "|" (pipe character)
> instead of "["  => 
> "[logon.senha]" instead of "|logon.senha]"
> 


	



	
		
_______________________________________________________ 
Promoção Yahoo! Acesso Grátis: a cada hora navegada você acumula cupons e concorre a mais de 500 prêmios! Participe! http://yahoo.fbiz.com.br/

Re: JSF does not find managed bean

Posted by Rick Gruber-Riemer <ri...@vanosten.net>.
My guess would be that you used "|" (pipe character) instead of "["  => 
"[logon.senha]" instead of "|logon.senha]"

Mike Kienenberger wrote:
> <h:inputSecret id="senha"
> value="#{logon.senha}"/>
>
>   private String password;
>
> I don't see anything beside the above inconsistency, but I'm pretty
> sure that you just translated senha to password in your first message
> so it'd be more clear.
>
> Try adding this to your form and see if you get better errors.
>
> <h:messages showDetail="true"/>
>
>
> On 10/19/05, drvpspam-myfaces@yahoo.com.br
> <dr...@yahoo.com.br> wrote:
>   
>> There is no conversion error stack trace.
>>
>> My jsp:
>> -------------------
>> <!doctype html public "-//w3c//dtd html 4.0
>> transitional//en">
>> <html>
>> <head>
>> <meta http-equiv="Content-Type" content="text/html;
>> charset=iso-8859-1">
>> <title>Teste - Login</title>
>> <%@ taglib uri="http://java.sun.com/jsf/html"
>> prefix="h" %>
>> <%@ taglib uri="http://java.sun.com/jsf/core"
>> prefix="f" %>
>> </head>
>>
>> <body>
>> <f:view>
>>
>> <h:form id="logonForm">
>> <h:messages/>
>>
>> <h:outputText value="Login:"/>
>> <h:inputText id="login" value="#{logon.login}"/><br/>
>>
>> <h:outputText value="Senha:"/>
>> <h:inputSecret id="senha"
>> value="#{logon.senha}"/><br/>
>>
>> <h:commandButton action="#{logon.logon}"
>> value="Entrar"/>
>>
>> </h:form>
>>
>> </f:view>
>> </body>
>> </html>
>> ---------------
>>
>> My faces-config.xml:
>>
>> ---------------
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems,
>> Inc.//DTD JavaServer Faces Config 1.0//EN"
>>
>> "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
>> <faces-config>
>>
>>  <managed-bean>
>>   <managed-bean-name>logon</managed-bean-name>
>>
>> <managed-bean-class>br.com.advocacia.arq.faces.LogonBean</managed-bean-class>
>>   <managed-bean-scope>request</managed-bean-scope>
>>  </managed-bean>
>>
>>  <navigation-rule>
>>
>>   <from-view-id>/logon.jsp</from-view-id>
>>
>>   <navigation-case>
>>    <from-outcome>sucesso</from-outcome>
>>    <to-view-id>/menu.jsp</to-view-id>
>>   </navigation-case>
>>
>>   <navigation-case>
>>    <from-outcome>falha</from-outcome>
>>    <to-view-id>/logon.jsp</to-view-id>
>>   </navigation-case>
>>
>>  </navigation-rule>
>>
>> </faces-config>
>> -------------------
>>
>> My web.xml:
>>
>> -------------------
>>
>> <web-app>
>>  <display-name>Advocacia</display-name>
>>  <description>Sistema de Advocacia</description>
>>
>>  <!-- Faces Servlet -->
>>  <servlet>
>>   <servlet-name>Faces Servlet</servlet-name>
>> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>>   <load-on-startup>1</load-on-startup>
>>  </servlet>
>>
>>  <!-- Faces Servlet Mapping -->
>>  <servlet-mapping>
>>   <servlet-name>Faces Servlet</servlet-name>
>>   <url-pattern>*.jsf</url-pattern>
>>  </servlet-mapping>
>>
>>  <!-- Parameters -->
>>  <context-param>
>> <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>>   <param-value>client</param-value>
>>  </context-param>
>>
>>  <context-param>
>> <param-name>javax.faces.application.CONFIG_FILES</param-name>
>> <param-value>/WEB-INF/config/faces-config.xml</param-value>
>>  </context-param>
>>
>> </web-app>
>>
>> -------------------
>>
>> LogonBean has two String attributes, login and senha
>> with their getters and setters and a method public
>> String logon().
>>
>> My application directory structure:
>>
>> app
>> +-advocacia.ear
>>   +- advocacia.war
>>     +- WEB-INF
>>        +- config
>>           +- faces-config.xml
>>        +- lib
>>           +- application libs
>>        +- web.xml
>>     +- application jsps
>>   +- arq.jar
>>      +- EJB classes and descriptors
>>   +- lib.jar
>>      +- other classes
>>   +- META-INF
>>      +- application.xml
>>
>> I hope you can find the error... :)
>>
>> Thanks,
>> David
>>
>> --- Mike Kienenberger <mk...@gmail.com> escreveu:
>>
>>     
>>> There's not enough information to speculate why that
>>> is happening.
>>> You'll need to post the conversion error stack trace
>>> (if there is one).
>>>
>>> You should probably also post your full jsp page and
>>> full faces-config file.
>>>       
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________________
>> Promoção Yahoo! Acesso Grátis: a cada hora navegada você acumula cupons e concorre a mais de 500 prêmios! Participe! http://yahoo.fbiz.com.br/
>>
>>     
>
>   


Re: JSF does not find managed bean

Posted by Mike Kienenberger <mk...@gmail.com>.
<h:inputSecret id="senha"
value="#{logon.senha}"/>

  private String password;

I don't see anything beside the above inconsistency, but I'm pretty
sure that you just translated senha to password in your first message
so it'd be more clear.

Try adding this to your form and see if you get better errors.

<h:messages showDetail="true"/>


On 10/19/05, drvpspam-myfaces@yahoo.com.br
<dr...@yahoo.com.br> wrote:
>
> There is no conversion error stack trace.
>
> My jsp:
> -------------------
> <!doctype html public "-//w3c//dtd html 4.0
> transitional//en">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">
> <title>Teste - Login</title>
> <%@ taglib uri="http://java.sun.com/jsf/html"
> prefix="h" %>
> <%@ taglib uri="http://java.sun.com/jsf/core"
> prefix="f" %>
> </head>
>
> <body>
> <f:view>
>
> <h:form id="logonForm">
> <h:messages/>
>
> <h:outputText value="Login:"/>
> <h:inputText id="login" value="#{logon.login}"/><br/>
>
> <h:outputText value="Senha:"/>
> <h:inputSecret id="senha"
> value="#{logon.senha}"/><br/>
>
> <h:commandButton action="#{logon.logon}"
> value="Entrar"/>
>
> </h:form>
>
> </f:view>
> </body>
> </html>
> ---------------
>
> My faces-config.xml:
>
> ---------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems,
> Inc.//DTD JavaServer Faces Config 1.0//EN"
>
> "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
> <faces-config>
>
>  <managed-bean>
>   <managed-bean-name>logon</managed-bean-name>
>
> <managed-bean-class>br.com.advocacia.arq.faces.LogonBean</managed-bean-class>
>   <managed-bean-scope>request</managed-bean-scope>
>  </managed-bean>
>
>  <navigation-rule>
>
>   <from-view-id>/logon.jsp</from-view-id>
>
>   <navigation-case>
>    <from-outcome>sucesso</from-outcome>
>    <to-view-id>/menu.jsp</to-view-id>
>   </navigation-case>
>
>   <navigation-case>
>    <from-outcome>falha</from-outcome>
>    <to-view-id>/logon.jsp</to-view-id>
>   </navigation-case>
>
>  </navigation-rule>
>
> </faces-config>
> -------------------
>
> My web.xml:
>
> -------------------
>
> <web-app>
>  <display-name>Advocacia</display-name>
>  <description>Sistema de Advocacia</description>
>
>  <!-- Faces Servlet -->
>  <servlet>
>   <servlet-name>Faces Servlet</servlet-name>
> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>   <load-on-startup>1</load-on-startup>
>  </servlet>
>
>  <!-- Faces Servlet Mapping -->
>  <servlet-mapping>
>   <servlet-name>Faces Servlet</servlet-name>
>   <url-pattern>*.jsf</url-pattern>
>  </servlet-mapping>
>
>  <!-- Parameters -->
>  <context-param>
> <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>   <param-value>client</param-value>
>  </context-param>
>
>  <context-param>
> <param-name>javax.faces.application.CONFIG_FILES</param-name>
> <param-value>/WEB-INF/config/faces-config.xml</param-value>
>  </context-param>
>
> </web-app>
>
> -------------------
>
> LogonBean has two String attributes, login and senha
> with their getters and setters and a method public
> String logon().
>
> My application directory structure:
>
> app
> +-advocacia.ear
>   +- advocacia.war
>     +- WEB-INF
>        +- config
>           +- faces-config.xml
>        +- lib
>           +- application libs
>        +- web.xml
>     +- application jsps
>   +- arq.jar
>      +- EJB classes and descriptors
>   +- lib.jar
>      +- other classes
>   +- META-INF
>      +- application.xml
>
> I hope you can find the error... :)
>
> Thanks,
> David
>
> --- Mike Kienenberger <mk...@gmail.com> escreveu:
>
> > There's not enough information to speculate why that
> > is happening.
> > You'll need to post the conversion error stack trace
> > (if there is one).
> >
> > You should probably also post your full jsp page and
> > full faces-config file.
>
>
>
>
>
>
>
>
>
> _______________________________________________________
> Promoção Yahoo! Acesso Grátis: a cada hora navegada você acumula cupons e concorre a mais de 500 prêmios! Participe! http://yahoo.fbiz.com.br/
>

Re: JSF does not find managed bean

Posted by dr...@yahoo.com.br.
There is no conversion error stack trace.

My jsp:
-------------------
<!doctype html public "-//w3c//dtd html 4.0
transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Teste - Login</title>
<%@ taglib uri="http://java.sun.com/jsf/html"
prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core"
prefix="f" %>  
</head>

<body>
<f:view>

<h:form id="logonForm">
<h:messages/>

<h:outputText value="Login:"/>
<h:inputText id="login" value="#{logon.login}"/><br/>

<h:outputText value="Senha:"/>
<h:inputSecret id="senha"
value="#{logon.senha}"/><br/>

<h:commandButton action="#{logon.logon}"
value="Entrar"/>

</h:form>

</f:view>
</body>
</html>
---------------

My faces-config.xml:

---------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems,
Inc.//DTD JavaServer Faces Config 1.0//EN"
                             
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
 
 <managed-bean>
  <managed-bean-name>logon</managed-bean-name>
 
<managed-bean-class>br.com.advocacia.arq.faces.LogonBean</managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
 </managed-bean>

 <navigation-rule>

  <from-view-id>/logon.jsp</from-view-id>

  <navigation-case>
   <from-outcome>sucesso</from-outcome>
   <to-view-id>/menu.jsp</to-view-id>
  </navigation-case>

  <navigation-case>
   <from-outcome>falha</from-outcome>
   <to-view-id>/logon.jsp</to-view-id>
  </navigation-case>

 </navigation-rule>

</faces-config>
-------------------

My web.xml:

-------------------

<web-app>
 <display-name>Advocacia</display-name>
 <description>Sistema de Advocacia</description>
	
 <!-- Faces Servlet -->
 <servlet>
  <servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
 </servlet>
	
 <!-- Faces Servlet Mapping -->
 <servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>*.jsf</url-pattern>
 </servlet-mapping>

 <!-- Parameters -->
 <context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
  <param-value>client</param-value>
 </context-param>

 <context-param>
<param-name>javax.faces.application.CONFIG_FILES</param-name>
<param-value>/WEB-INF/config/faces-config.xml</param-value>
 </context-param>
	
</web-app>

-------------------

LogonBean has two String attributes, login and senha
with their getters and setters and a method public
String logon().

My application directory structure:

app
+-advocacia.ear
  +- advocacia.war
    +- WEB-INF
       +- config
          +- faces-config.xml
       +- lib
          +- application libs
       +- web.xml
    +- application jsps
  +- arq.jar
     +- EJB classes and descriptors
  +- lib.jar
     +- other classes
  +- META-INF
     +- application.xml

I hope you can find the error... :)

Thanks,
David

--- Mike Kienenberger <mk...@gmail.com> escreveu:

> There's not enough information to speculate why that
> is happening.
> You'll need to post the conversion error stack trace
> (if there is one).
> 
> You should probably also post your full jsp page and
> full faces-config file.



	



	
		
_______________________________________________________ 
Promoção Yahoo! Acesso Grátis: a cada hora navegada você acumula cupons e concorre a mais de 500 prêmios! Participe! http://yahoo.fbiz.com.br/

Re: JSF does not find managed bean

Posted by Mike Kienenberger <mk...@gmail.com>.
There's not enough information to speculate why that is happening.
You'll need to post the conversion error stack trace (if there is one).

You should probably also post your full jsp page and full faces-config file.

On 10/19/05, drvpspam-myfaces@yahoo.com.br
<dr...@yahoo.com.br> wrote:
> When I remove immediate=true I receive a "Conversion
> Error" message. But I'm not using any conversor and my
> attributes are both strings...
>
> Thanks,
> David.
>
> --- Mike Kienenberger <mk...@gmail.com> escreveu:
>
> > What's probably happening is that you're trying to
> > access your login
> > and password components from logon.   Those values
> > won't contain valid
> > input if you're skipping the conversion and
> > validation phases.
> >
> > Remove the immediate=true attribute.
> >
> > JSF moves data through several stages before it's
> > bound to your
> > models, and those stages are not reached when you
> > use immediate=true.
> >
> > First, the data starts as form data in the request.
> > Then it's set as the "submittedValue" for the
> > component  in the
> > applyValues phase, then it's validated/converted in
> > the
> > processValidations phase and set as a "localValue"
> > for your component,
> > then it's put into your backing bean in the
> > updateModel phase.
> >
> > By using immediate=true, you're executing your
> > action between the
> > applyValue and processValidations phase, so the only
> > data available is
> > on the component itself.
>
>
>
>
>
>
>
>
> _______________________________________________________
> Promoção Yahoo! Acesso Grátis: a cada hora navegada você acumula cupons e concorre a mais de 500 prêmios! Participe! http://yahoo.fbiz.com.br/
>

Re: JSF does not find managed bean

Posted by dr...@yahoo.com.br.
When I remove immediate=true I receive a "Conversion
Error" message. But I'm not using any conversor and my
attributes are both strings...

Thanks,
David.

--- Mike Kienenberger <mk...@gmail.com> escreveu:

> What's probably happening is that you're trying to
> access your login
> and password components from logon.   Those values
> won't contain valid
> input if you're skipping the conversion and
> validation phases.
> 
> Remove the immediate=true attribute.
> 
> JSF moves data through several stages before it's
> bound to your
> models, and those stages are not reached when you
> use immediate=true.
> 
> First, the data starts as form data in the request.
> Then it's set as the "submittedValue" for the
> component  in the
> applyValues phase, then it's validated/converted in
> the
> processValidations phase and set as a "localValue"
> for your component,
> then it's put into your backing bean in the
> updateModel phase.
> 
> By using immediate=true, you're executing your
> action between the
> applyValue and processValidations phase, so the only
> data available is
> on the component itself.


	



	
		
_______________________________________________________ 
Promoção Yahoo! Acesso Grátis: a cada hora navegada você acumula cupons e concorre a mais de 500 prêmios! Participe! http://yahoo.fbiz.com.br/

Re: JSF does not find managed bean

Posted by Mike Kienenberger <mk...@gmail.com>.
What's probably happening is that you're trying to access your login
and password components from logon.   Those values won't contain valid
input if you're skipping the conversion and validation phases.

Remove the immediate=true attribute.

JSF moves data through several stages before it's bound to your
models, and those stages are not reached when you use immediate=true.

First, the data starts as form data in the request.
Then it's set as the "submittedValue" for the component  in the
applyValues phase, then it's validated/converted in the
processValidations phase and set as a "localValue" for your component,
then it's put into your backing bean in the updateModel phase.

By using immediate=true, you're executing your action between the
applyValue and processValidations phase, so the only data available is
on the component itself.

On 10/19/05, drvpspam-myfaces@yahoo.com.br
<dr...@yahoo.com.br> wrote:
>
> Thanks for your answer. Here are my jsp and my managed
> bean codes:
>
> Jsp:
> ------------------
> <h:form id="logonForm">
> <h:messages/>
>
> [...]
>
> <h:commandButton action="#{logon.logon}"
> immediate="true" value="Submit"/>
>
> </h:form>
> ------------------
>
> LogonBean:
> ------------------
> public class LogonBean {
>
>         private String login;
>
>         private String password;
>
>         public String logon() {
>             // method impl.
>         }
>
>         // getters/setters
> }
> ----------------
>
> David.
>
> --- Mike Kienenberger <mk...@gmail.com> escreveu:
>
> > What does your jsp look like?
> >
> > What is the method signature for logon()?
> >
> > It must be "public String logon()" if you're using
> > "action="#{logon.logon}" and it must be public void
> > logon(ActionEvent
> > event) if you're using
> > "actionListener="#{logon.logon}".
>
>
>
>
>
>
>
>
> _______________________________________________________
> Promoção Yahoo! Acesso Grátis: a cada hora navegada você acumula cupons e concorre a mais de 500 prêmios! Participe! http://yahoo.fbiz.com.br/
>

Re: JSF does not find managed bean

Posted by dr...@yahoo.com.br.
Thanks for your answer. Here are my jsp and my managed
bean codes:

Jsp:
------------------
<h:form id="logonForm">
<h:messages/>

[...]

<h:commandButton action="#{logon.logon}"
immediate="true" value="Submit"/>

</h:form>
------------------

LogonBean:
------------------
public class LogonBean {

	private String login;
	
	private String password;

	public String logon() {
            // method impl.
        }

        // getters/setters
}
----------------

David.

--- Mike Kienenberger <mk...@gmail.com> escreveu:

> What does your jsp look like?
> 
> What is the method signature for logon()?
> 
> It must be "public String logon()" if you're using
> "action="#{logon.logon}" and it must be public void
> logon(ActionEvent
> event) if you're using
> "actionListener="#{logon.logon}".


	



	
		
_______________________________________________________ 
Promoção Yahoo! Acesso Grátis: a cada hora navegada você acumula cupons e concorre a mais de 500 prêmios! Participe! http://yahoo.fbiz.com.br/

Re: JSF does not find managed bean

Posted by Mike Kienenberger <mk...@gmail.com>.
What does your jsp look like?

What is the method signature for logon()?

It must be "public String logon()" if you're using
"action="#{logon.logon}" and it must be public void logon(ActionEvent
event) if you're using "actionListener="#{logon.logon}".

On 10/19/05, drvpspam-myfaces@yahoo.com.br
<dr...@yahoo.com.br> wrote:
>
> Hi, everyone. I'm learning JSF and I'm having some
> headaches.
>
> I have a managed bean called LogonBean with two String
> attributes, login and password, their getters and
> setters and a method called logon(). In the jsp I have
> a commandButton that calls the logon method.
>
> When I click the commandButton, logon() is never
> called; instead, an error message "Conversion Error"
> is displayed. As my attributes are both String and no
> conversion is required, I put immediate="true" on the
> button to skip validation/convertion. Then, this
> exception was thrown:
>
> -------------------
>
> 18:16:01,859 ERROR [[Faces Servlet]] Servlet.service()
> for servlet Faces Servlet threw exception
>  javax.faces.FacesException: Error calling action
> method of component with id logonForm:_id3
>         at
> org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
>         at
> [...]
>
> Caused by: javax.faces.el.EvaluationException:
> Exception while invoking expression #{logon.logon}
>         at
> org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:165)
>         at
> org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
>         ... 25 more
>
> Caused by: javax.faces.el.PropertyNotFoundException:
> Base is null: logon
>         at
> org.apache.myfaces.el.ValueBindingImpl.resolveToBaseAndProperty(ValueBindingImpl.java:457)
>         at
> org.apache.myfaces.el.MethodBindingImpl.resolveToBaseAndProperty(MethodBindingImpl.java:180)
>         at
> org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:114)
>         ... 26 more
>
> -------------------
>
> I think that the managed bean is not being found, am I
> right? Its declaration on faces-config.xml is like
> this:
>
> Code:
>
> <managed-bean>
>   <managed-bean-name>logon</managed-bean-name>
>
> <managed-bean-class>br.com.advocacia.arq.faces.LogonBean</managed-bean-class>
>   <managed-bean-scope>request</managed-bean-scope>
> </managed-bean>
>
>
> And all my classes are in a file lib.jar which I
> declared in application.xml:
>
> Code:
>
>  <application>
>
>   [...]
>
>         <module>
>                 <java>lib.jar</java>
>         </module>
>
>  </application>
>
>
> Please, does anyone knows what is going wrong?
>
>
>
>
>
>
>
>
>
> _______________________________________________________
> Promoção Yahoo! Acesso Grátis: a cada hora navegada você acumula cupons e concorre a mais de 500 prêmios! Participe! http://yahoo.fbiz.com.br/
>