将参数从 JSF 发送到 Webflow 转换
基本上我现在拥有的是这样的:
<view-state id="pageOne" view="pageone.xhtml">
<transition on="gotoPageTwo" to="doGotoPageTwo" />
</view-state>
<subflow-state id="doGotoPageTwo" subflow="pageTwo">
<transition on="return" to="pageOne" />
</subflow-state>
JSF 代码是:
<h:commandLink value="Page Two" action="gotoPageTwo" />
到目前为止一切顺利。接下来我想做的是类似于:
<h:commandLink value="Page Two" action="gotoPageTwo(customArgument)" />
并且:
<view-state id="pageOne" view="pageone.xhtml">
<transition on="gotoPageTwo" to="doGotoPageTwo" />
</view-state>
<subflow-state id="doGotoPageTwo" subflow="pageTwo">
<input name="myCustomArgument" value="customArgument" />
<transition on="return" to="pageOne" />
</subflow-state>
我知道这显然不能按原样工作,但希望您能理解这个概念。我发现的唯一解决方案是使用 actionListener 将数据放入某种伪全局变量中(在链接 bean 中或在 flash-/flow-Scope 中)。这似乎是一个丑陋的解耦解决方案,与将参数放入全局变量而不是在 C++ 中传递它们没有太大区别。有没有更好的方法来做到这一点?
诗。我们也使用 Primefaces,但我认为这与这种情况无关。
Basically what I have now is something like:
<view-state id="pageOne" view="pageone.xhtml">
<transition on="gotoPageTwo" to="doGotoPageTwo" />
</view-state>
<subflow-state id="doGotoPageTwo" subflow="pageTwo">
<transition on="return" to="pageOne" />
</subflow-state>
With the JSF code being:
<h:commandLink value="Page Two" action="gotoPageTwo" />
So far so good. What I want to do next is something similar to:
<h:commandLink value="Page Two" action="gotoPageTwo(customArgument)" />
And:
<view-state id="pageOne" view="pageone.xhtml">
<transition on="gotoPageTwo" to="doGotoPageTwo" />
</view-state>
<subflow-state id="doGotoPageTwo" subflow="pageTwo">
<input name="myCustomArgument" value="customArgument" />
<transition on="return" to="pageOne" />
</subflow-state>
I know this obviously doesn't work as is, but hopefully you get the concept. The only solution I've found is using an actionListener to put the data in some kind of pseudo-global variable (either in a linked bean or in the flash-/flow-Scope). This seems like an ugly decoupled solution, not much different from putting your arguments in global variables instead of passing them in c++. Is there any better way to do this?
Ps. We also use Primefaces but I don't think that's relevant in this situation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论