This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting simple JBoss Seam sample to work

 
Peter Irmstadt
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I am new to Java EE (I do know Java SE, Annotations and Generics ). I am currently trying to learn the basics of Seam by "learning by doing".

What I want for my first lesson is to store data in a MySQL table. So I created a new Seam project using JBoss Tools for Eclipse using JBoss AS and my local MySQL 5 Server.

Then I created a new class below the MyProject-ejb/ejbModule/ folder:



then I created a second class:



and the related Interface



finally I created a new page and inserted



But when I try to enter some value and click the button, the following error message appears:


ERROR [application] javax.el.PropertyNotFoundException: /test.xhtml @22,83 action="#{register.register}": Target Unreachable, identifier 'register' resolved to null


Do I have to register that component somewhere? What causes that error?

Thank you in advance!
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change the method public String register() into public String getRegister()
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Irmstadt wrote:
ERROR [application] javax.el.PropertyNotFoundException: /test.xhtml @22,83 action="#{register.register}": Target Unreachable, identifier 'register' resolved to null

Is it declared as a managed bean? Do you know the JSF basics?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remko Strating wrote:Change the method public String register() into public String getRegister()

You're wrong.
1) The error points to the first part of #{register.register}, not the second.
2) Action methods are usually not prefixed with "get".
3) Action methods are to be written with their full method name in EL.
 
sunil k tiwari
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you check your project has seam.properties file or not , it is required even though it is an empty file
 
Peter Irmstadt
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sunil k tiwari wrote:did you check your project has seam.properties file or not , it is required even though it is an empty file

I created my project using the JBoss Tools Seam Project Creation Wizard - so yes, I do have that (empty) file.

Bauke Scholtz wrote:
Peter Irmstadt wrote:
ERROR [application] javax.el.PropertyNotFoundException: /test.xhtml @22,83 action="#{register.register}": Target Unreachable, identifier 'register' resolved to null

Is it declared as a managed bean? Do you know the JSF basics?


Well, I am working on the basics

I read on my books that Seam doesn't use the XML files to register managed beans anymore but just annotations instead. That is right, isn't it? (I looked at the registration example inside the seam download archive and didn't find any XML reference there as well)

Any other ideas what might be wrong?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic