File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in a bean

 
rachid elmaazouz
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2984
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 218
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use #{userBean....} with a lowercase "u" consistently. You currently have UserBean and userBean.

Regards,
Brendan.
 
rachid elmaazouz
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic