我在使用 EL 和 javascript 函数(JSF 1.2、Facelets、Richfaces 3.3.0GA)时遇到问题。我有一个页面包含另一个组合:
<ui:include src="/pages/panels/examinationPanel.xhtml">
<ui:param name="prefix" value="new" />
而在我的ui:composition
我想附加prefix
到每一个id。例如:
<rich:modalPanel id="#{prefix}_examinationPanel">
这样就可以了。
但是当我想访问诸如以下函数中的组件时,问题就来了oncomplete
我无法让它正确连接字符串。例如
oncomplete="#{rich:component('#{prefix}_examinationPanel')}.show();"
我尝试过fn:join
也一样,但它不会执行该函数,因为当它找到“#”字符时它会抱怨错误。例如:
oncomplete="#{rich:component(fn:join(#{prefix},'examinationPanel'))}.show()"
throws
SEVERE: Servlet.service() for servlet Faces Servlet threw exception org.apache.el.parser.ParseException: Encountered "fn:join( #" at line 1, column 33.
Encountered "fn:join( #"
如果我用方括号或#和方括号括起来,则会出现不同的错误。
我究竟做错了什么?
还有另一个问题,在条件命令中,例如
oncomplete="#{a}?#{b}:#{c}"
当 true 或 false 时,我如何“分组”以便能够执行更多操作?例如这样的事情:
oncomplete="#{a}?(#{b}#{f}):(#{c}#{d}#{e})"
我尝试过使用括号,但无法正确解析它。
提前致谢。