如何在方法中传递EL参数? [英] How to pass EL argument in method?
问题描述
我只是在支持bean方法上传递参数方面有一个问题。
I have just a question in passing parameters on backing beans method.
我想在方法参数之间传递EL值,例如:
I would like pass an EL value between a method parameters like:
<p:selectOneMenu id="somsgroup" value="#{store_itemController.filter_sgroup}">
<f:selectItems value="#{commonDataFunctions.getItemByName('store_sgroup', 'id', 'title', '[tb:store_sgroup][fd:title]=${store_itemController.filter_group}', '[tb:store_sgroup][fd:title]', true)}"/>
</p:selectOneMenu>
好像是 $ {store_itemController.filter_group}
不会翻译,因为该方法会像字符串一样接收 $ {store_itemController.filter_group}
。
it seems like ${store_itemController.filter_group}
it is not translated because the method receives ${store_itemController.filter_group}
just like a string.
一个解决方案?
推荐答案
您确实不能以这种方式嵌套EL表达式。
You can indeed not nest EL expressions this way. EL expressions can only be inlined.
您可以使用< c:set>
创建一个新变量,其中所需的表达式插入所需的值,然后将该变量用作另一个EL表达式的参数。
You can use <c:set>
to create a new variable wherein the desired expression is inlined in the desired value and then reuse this variable as argument of another EL expression.
xmlns:c="http://java.sun.com/jsp/jstl/core"
...
<c:set var="filterGroup" value="[tb:store_sgroup][fd:title]=#{store_itemController.filter_group}" scope="request" />
...
<f:selectItems value="#{commonDataFunctions.getItemByName('store_sgroup', 'id', 'title', filterGroup, '[tb:store_sgroup][fd:title]', true)}"/>
这篇关于如何在方法中传递EL参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!