wood burning stoves 2.0*
The moose likes JSF and the fly likes commandButton in dataTable doesn't work -method not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "commandButton in dataTable doesn Watch "commandButton in dataTable doesn New topic
Author

commandButton in dataTable doesn't work -method not found

Mark Moge
Ranch Hand

Joined: Mar 14, 2009
Posts: 96

Hi everyone! I am new in JSF world and can't find a solution to my problem.

I have a dataTable with data from DB(int id, varchar name, int phone ). In 4th column i have button and I don't have any idea how to write a method which take data from the table and send them to other site for example edit.jsp . I tried:


just to change page, but always had "javax.servlet.ServletException: #{customer.send}: javax.el.MethodNotFoundException: Method not found: {ID=1, NAME=marek, PHONE=997}.send()" I want send data to other page then edit them and save in database. If someone can help me i will be very grateful.
index.jsp


faces-config.xml


CustomerBean.java



SCJP6 | http://programmerutilities.blogspot.com/
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
If the bean is request scoped, you need to preserve the same datamodel for the subsequent request.
Marek Moge wrote:


This expects a public String woo() in the Customer object.
Marek Moge wrote:


This is completely out of the scope of the datatable. There is no Customer object here.
Mark Moge
Ranch Hand

Joined: Mar 14, 2009
Posts: 96

Yes, I know that. I made a mistake and past a wrong code. Anyway I changed the code in first post and method send() works out of dataTable but in throws error.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Okay, the first and the third part of my reply still stays.
Mark Moge
Ranch Hand

Joined: Mar 14, 2009
Posts: 96

ad 1.the scope of bean is session
<managed-bean-scope>session</managed-bean-scope>

ad 3. this method is from CustomerBean class and works fine out of the dataTable.

Maybe i ask wrong question. Do you know how to write a method which takes data from this table

for example id=2, name="Mark" phone=998, changes page to edit.jsp and prints them by clicking the second button.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Oh, now I see

You gave the row object instance the same name as the managed bean! Give one of them a different name so that JSF knows which bean it should have.
Mark Moge
Ranch Hand

Joined: Mar 14, 2009
Posts: 96

.
Mark Moge
Ranch Hand

Joined: Mar 14, 2009
Posts: 96

I've changed var from "customer" to "cust" and it works now . Thanks a lot.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: commandButton in dataTable doesn't work -method not found
 
Similar Threads
Which Package to Import to Use FacesContext's getRequestMap()?
HtmlDataTable and "duplicate ID"
creating a table component dynamically
Providing anchor to columns in a datatable
JSF ArralyList rendering to Target page is throwing Class Cast Exception