Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I want to make a method call from the jsf and pass parameter to it.

 
Shruti B
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem: I want to make a method call from the jsf and pass parameter to it.

1. I have a description field which is of 500 characters.
2. I want to show only 37 charcters of the whole description field in the jsf page.
3. So i decided to write a mthod which would convert those 500 characters from the database to the 37 characters but this i dont know how to make the mehtod call and pass the parameter to it.


Please Help
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try calling your method from the getDescription() of ManagedBean/BackingBean, whichever you used to bind to your component.

Thanks,
 
g madhava
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

3. So i decided to write a mthod which would convert those 500 characters from the database to the 37 characters but this i dont know how to make the mehtod call and pass the parameter to it.


What parameter are you planning to pass ? what method are you planning

I am assuming that you know how JSF handles the method calls using value binding expressions. (for example, in your case it will be #{someBean.description}. This will invoke the getDescription() method of "someBean" managed bean to set the value for that JSF component(In your case, it might be a "textbox" or a "textarea").

some code to get you started.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic