-
-
2. Re: Facelets Param for action method
jpviragine.jpviragine.gmail.com Mar 17, 2008 5:28 PM (in response to fmotlik)Florian,
Try this:
<h:inputTextarea id="#{id}" value="#{input}" required="true"> <a4j:support ajaxSingle="true" onsubmit="changed()" event="onchange" action="#{actionBean[action]}" /> </h:inputTextarea>
Usage:
<ui:include src="shared/inputTextArea.template.xhtml"> <ui:param name="id" value="numberOfObjects"/> <ui:param name="input" value="#{selectedProject.projectBasis.numberOfObjects}"/> <ui:param name="actionBean" value="#{selectedProject.projectBasis}"/> <ui:param name="action" value="touch}"/> </ui:include>
Cheers,
JP
-
3. Re: Facelets Param for action method
fmotlik Mar 17, 2008 6:16 PM (in response to fmotlik)thx for the incredibly fast help. Everything works absolutely perfect.
-
4. Re: Facelets Param for action method
fmotlik Mar 21, 2008 3:09 PM (in response to fmotlik)Hi
I did implement it now the way you mentioned and it worked fine, but the problem is now, that we have to use a method like this
action#{bean.anyMethod(node)}
We use it for a clickable trinidad treetable so when you klick one of the Items the action gets called. It's easyiest to do by passing the node as a value, so we used that syntax. Now the problem is, that I would like to have that tree in a template, but it doesn't work in any way that I've tried so far.
I set the action to
someAction(node)
action#{actionBean[action]}
but that didn't work. I also tried
action
someAction
action#{actionBean[action](node)}
and this:
actionsomeAction(node)
action#{actionBean[action(node)]}
I know, that it would be possible to make my own EL function like described in the IBM article referenced above, but if possible I would like to use EL syntax without having to code some java.
-
5. Re: Facelets Param for action method
fmotlik Mar 25, 2008 10:40 AM (in response to fmotlik)No one got any clue how to achieve this?
Does anyone of you have an idea how to implement the clickable treeTable without having to pass the parameter? The table goes recursively over the data and actionBean.action(node) is used as the action for a commandLink.
The syntax is very easy to use and we do not have to circumvent the inability of Standard EL to pass parameters. But the problem with this is that the lookup with the
actionBean[action]
syntax doesn't work, because the parameter can't, as far as I've tried, be passed to the action.Does anyone of you know another way how to do that, so we can put the tree into a template.
-
6. Re: Facelets Param for action method
barbacena Mar 27, 2008 4:02 AM (in response to fmotlik)Use the h:inputText valueChangeListener to capture the value and the action from a4j:support to execute the code.
Unfortunately facelets doesn't help much on this.
[]s
-
7. Re: Facelets Param for action method
jarda222 Sep 8, 2008 5:41 PM (in response to fmotlik)
Joao Viragine wrote on Mar 17, 2008 17:28:
Florian,
Try this:<h:inputTextarea id="#{id}" value="#{input}" required="true"> <a4j:support ajaxSingle="true" onsubmit="changed()" event="onchange" action="#{actionBean[action]}" /> </h:inputTextarea>
Usage:<ui:include src="shared/inputTextArea.template.xhtml"> <ui:param name="id" value="numberOfObjects"/> <ui:param name="input" value="#{selectedProject.projectBasis.numberOfObjects}"/> <ui:param name="actionBean" value="#{selectedProject.projectBasis}"/> <ui:param name="action" value="touch}"/> </ui:include>
Cheers,
JPUnfortunately this solution doesn't work for me.
I have page1.xhtml:
<ui:include src="search.xhtml"> <ui:param name="actionBean" value="#{bean1}"/> <ui:param name="action" value="selected}"/> </ui:include>
than I have page2.xhtml:
<ui:include src="search.xhtml"> <ui:param name="actionBean" value="#{bean2}"/> <ui:param name="action" value="selected}"/> </ui:include>
If I visit first page1.xhtml the bean1.selected is called. When I switch to page2.xhtml I would expect that bean2.selected is called, but unfortunately again bean1.selected is called.
When I restart server and visit page2.xhtml, first. The bean2.selected is called. If I visit page1.xhtml, again bean2.selected is called.
It seams that the action is somehow cached. But I don't know where and why.
Could you please help me?
Cheers,
Dusan
-
8. Re: Facelets Param for action method
jarda222 Sep 10, 2008 8:17 AM (in response to fmotlik)Hi,
I found that I had mistake in binding.
Dusan
-
9. Re: Facelets Param for action method
hhcofcmds Feb 9, 2010 2:11 PM (in response to fmotlik)I had a similar problem some months ago. I created a method:
public void evaluateMethodBinding(String el) { ValueExpression ve = FacesContext.getCurrentInstance().getApplication().getExpressionFactory() .createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{" + el + "}", Object.class); ve.getValue(FacesContext.getCurrentInstance().getELContext()); }
in a backing bean named 'ELEvaluator' and then I use
action="#{ELEvaluator.evaluateMethodBinding(action)}"
Where 'action' is a parameter of the facelets component. This supports parameters and everything, only you have to write the EL as a string:
<my:actionComponent [...] action="backing.method(params)"/>
-
10. Re: Facelets Param for action method
eryz Nov 22, 2012 5:07 AM (in response to fmotlik)#{actionBean[action(node)]}
Any simple solutions with syntax like this one to pass parameters too?
if not any standart hacks about it?