seam的pages.xml中存在重复的
使用seam,在pages.xml中,我可以捕获查询字符串参数的值并将其放入支持bean中,如下所示:
<page view-id="/my/page.xhtml" >
<param name="myParam" value="#{myActionBackingBean.param}" />
<action execute="#{myActionBackingBean.doAction()}" />
</page>
据我所知,这也会从支持bean中取出值并将其放回在重定向的查询字符串中(即定义双向绑定)。
在我正在处理的项目中,我们有几个带有重复参数的页面,如下所示:
<page view-id="/my/page.xhtml" >
<param name="myParam" value="#{myActionBackingBean.param}" />
<param name="myParam" value="#{myDifferentBackingBean.param}" />
<action execute="#{myActionBackingBean.doAction()}" />
</page>
这似乎编译并运行良好,但 eclipse 已开始报告错误(自最近更新以来,可能是插件更新)“Value对于第二个参数名称,“myParam 不是唯一的”。
- 像这样的重复参数标签是否按照 Eclipse 的建议无效?
- 在第二种情况下最有可能出现的行为是什么?
- 是否有另一种方法可以将查询字符串参数的值获取到两个 bean 中(例如,可以使用
使用 EL 从一个 bean 复制到另一个 bean 来完成)
我有一个有很多seam和EL需要学习,所以如果这些问题看起来很幼稚,我很感激任何好的资源。
Using seam, in pages.xml I can catch the value of a query string parameter and put it in a backing bean like so:
<page view-id="/my/page.xhtml" >
<param name="myParam" value="#{myActionBackingBean.param}" />
<action execute="#{myActionBackingBean.doAction()}" />
</page>
As far as I've read, this will also take the value out of the backing bean and put it back in the query string over a redirect (i.e. defines a two-way binding).
In the project I'm working on, we have a few pages with duplicate params, like this:
<page view-id="/my/page.xhtml" >
<param name="myParam" value="#{myActionBackingBean.param}" />
<param name="myParam" value="#{myDifferentBackingBean.param}" />
<action execute="#{myActionBackingBean.doAction()}" />
</page>
This seems to compile and run fine, but eclipse has started reporting an error (since a recent update, possibly a plugin update) that "Value myParam is not unique" for the second param name.
- Are duplicate param tags like this invalid as suggested by eclipse?
- What is the most likely behaviour to expect in the second case?
- Is there another way to get the value of a query string parameter into two beans (could it be done using an
<action>
to copy from one to the other with EL, for example)
I have a lot of seam and EL to learn so I'm grateful for any good sources if these questions seem naive.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许最好的方法是创建另一个 bean 来保存您的信息并将其简单地绑定到它。
然后您可以将其注入到 myActionBackingBean 和 myDifferentBackingBean 中。
否则,您可以在 @Create 方法期间将其从一个复制到另一个。
Probably the best way to do so is to create another bean just to keep your information and simply bind it to it.
Then you can inject it into myActionBackingBean and myDifferentBackingBean.
Otherwise you can copy it from one to another during the @Create method.