Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

commandButton in dataTable doesn't work -method not found

 
Ranch Hand
Posts: 101
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 101
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, the first and the third part of my reply still stays.
 
Mark Moge
Ranch Hand
Posts: 101
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 101
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
.
 
Mark Moge
Ranch Hand
Posts: 101
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've changed var from "customer" to "cust" and it works now . Thanks a lot.
 
Lasagna is spaghetti flvored cake. Just like this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic