我需要实现一个将列表传递给其后备bean的ice:commandButton
。我不在portlet范围内,但在标记范围内。f:属性是否支持String以外的其他东西?
我知道当我从actionListener检索到f:attribute
时,我得到一个必须被转换的对象。
我想知道如果我可以映射f:属性为List<MyClass>
,在列表中的实际情况是实际上的ArrayList
和MyClass
是序列化的。
喜欢的东西:
MyTag.xhtml
<ice:commandButton actionListener="#{TagBean.doPrintItems}">
<f:attribute name="collection" value="#{items}" />
</ice:commandButton>
//[other things]
MyPortlet.jspx
<my:printPopup items="#{BackingBean.itemsToPrint}" />
BackingBean.java
class BackingBean {
private List<MyClass> itemsToPrint;
//getter and setter of course
}
TagBean.java
class TagBean {
private List<MyClass> collection;
//getter and setter of course
public void doPrint(ActionEvent e) {
collection = (List<MyClass>) e.getComponent().getAttributes().get("collection");
}
您认为这样可行吗?谢谢
它应该只是工作。你面临的问题是什么?这个问题并不清楚。 – BalusC
没问题。在进行此操作之前,我还有其他任务需要执行。 **如果我用按钮触击了**,发现这种方式不可行,那么我肯定会大幅回滚。我期望在下周一进入按钮的事情 –