aspose file tools*
The moose likes JSF and the fly likes problem in a bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "problem in a bean" Watch "problem in a bean" New topic
Author

problem in a bean

rachid elmaazouz
Greenhorn

Joined: Jul 21, 2012
Posts: 3
Hi all
I am about developing a web application using JSF 2.0 and netbeans 7.1.2


I have a user bean UserBean wich is defined by








and a login form:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:pou="http://primefaces.org/ui">


<pou:panel header="Login" widgetVar="dlg" style="width: 500px;height: 180px;" >
<h:form id="form" >

<h:panelGrid columns="2" style="margin-bottom:10px">
<hutputText value="Username" />
<pou:inputText value="#{UserBean.username}"/>

<hutputText value="Password" />
<pou:password value="#{userBean.password}" />
</h:panelGrid>

<h:panelGrid columns="2">
<pou:commandButton value="Connect" type="submit" action="#{userBean.login()}" ajax="false" />
<pou:commandButton value="Reset" type="reset" />
</h:panelGrid>

</h:form>
</pou:panel>


</html>



when I run the application and submit username and password I got the following error:


/loginForm.xhtml @13,62 value="#{UserBean.username}": Target Unreachable, identifier 'UserBean' resolved to null


is there any thing I have to add to the UserBean class??
thanks for help


Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2864
    
  11

You haven't put a name in the managed bean annotation, and I believe the default would be userBean, with a lowercase u.
rachid elmaazouz
Greenhorn

Joined: Jul 21, 2012
Posts: 3
Greg Charles wrote:You haven't put a name in the managed bean annotation, and I believe the default would be userBean, with a lowercase u.


Yes, but even when I change the @ManagedBean to @ManagedBean(name="userBean") the problem persist
Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218
You need to use #{userBean....} with a lowercase "u" consistently. You currently have UserBean and userBean.

Regards,
Brendan.
rachid elmaazouz
Greenhorn

Joined: Jul 21, 2012
Posts: 3
Brendan Healey wrote:You need to use #{userBean....} with a lowercase "u" consistently. You currently have UserBean and userBean.

Regards,
Brendan.


Even when I change the userbean the problem persist, I think that I need reinstall the software and try again because, previously everything was fine and the form gives the desired result
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in a bean