• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Erkut Yz
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18226
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic