wood burning stoves 2.0*
The moose likes JSF and the fly likes Passing both action method names and parameters as arguments to facelets componenets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Passing both action method names and parameters as arguments to facelets componenets" Watch "Passing both action method names and parameters as arguments to facelets componenets" New topic
Author

Passing both action method names and parameters as arguments to facelets componenets

Erkut Yz
Greenhorn

Joined: Nov 22, 2012
Posts: 1
When calling a template I know passing the method name as a parameter name should be done in this way:


in the component:


and I also know that I can pass the parameters if method name is not a variable ,for ex for the display method, like:


in the component:


But I cannot pass both the method name and parameter(s) at the same time

I thought the expression will do the job but it gives a parsing error.

Any ideas?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15961
    
  19

Do not attempt to use the template as though it was code. A template is a model display definition and if you put logic in it, you are breaking the MVC Separation of Concerns contract, and that, in turn, makes your application much harder/more expensive to maintain. The only logic on a JSF template should be stuff that directs the rendering of the template elements.

JSF isn't designed with the idea of passing arbitrary data to and from the client. Except for form data, JSF normally expects all data to be residing on the server (in backing beans, or at least accessible via backing beans). So there's no need to code references to the application data in constructs like parameters on the View Template.

JSF EL supports doing stuff like that, but that's because no one solution fits everything. There is a cost involved, however, which is why doing stuff like parameters on templates should be the last resort of a knowledgeable developer, instead of the first resort of someone who just wants JSF to work like more primitive systems do. The whole point of using JSF instead of more primitive solutions is precisely because the primitive systems require more work to get things done.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing both action method names and parameters as arguments to facelets componenets
 
Similar Threads
Struts2: REST URLs with Convention plug in - passing params through the URL
Making a collection of unique values
Passing parameter with a Submit Link
pass parameter to binding method
Passing attributes with <ice:commandButton>