File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Call back bean method from a facelet template. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Call back bean method from a facelet template." Watch "Call back bean method from a facelet template." New topic
Author

Call back bean method from a facelet template.

Jakim Rachev
Greenhorn

Joined: Sep 04, 2010
Posts: 14
Hi,

I've looked every where for that, and I just can't find a solution. I have a composition element which I want to include in various facelet pages, every each with a unique backBean but sharing same interface. So is there any way to pass only the backBean instance to this composition element from the client pages. I tried this method:

Composition Element comEl.xhtml


Client page page1.xhtml backBean=page1Bean


Actually disabled="#{bean.getCount()==0}" works ok, if the count is 0 the link gets disabled.
But action="#{bean.sayHello}" doesn't work.

Exception during request processing:
Caused by javax.el.PropertyNotFoundException with message: "Target Unreachable, identifier 'bean' resolved to null"
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15629
    
  15

I'm not sure what your problem is, unless there's something funny about the "s:link" element itself. I do this sort of thing extensively and other than my choice of elements in the included text, that's the way I do it.

Although a quick check indicates I'm using "ui:component", not "ui:composition". I can't remember the difference offhand, but I'm fairly sure that one of them limits the context that gets pulled in.


Customer surveys are for companies who didn't pay proper attention to begin with.
Jakim Rachev
Greenhorn

Joined: Sep 04, 2010
Posts: 14
Yes it seems that the problem is in <s:link>. Just right now i tried with h:commandLink and everything was just fine.
Thanks Tim.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Call back bean method from a facelet template.
 
Similar Threads
How to isolate Ajax rendered area for ui:include loaded view in richfaces 4.x
Use the same facelet component with different parameters
Passing bean instance as param to a facelet. Using seam
internationlization in facelet seems not working well
Need a rollover effect when UIComponent is disabled and vice versa