jsf-2.0如何将值从一个类传递到另一个 [英] jsf-2.0 how to pass a value from one class to another

查看:187
本文介绍了jsf-2.0如何将值从一个类传递到另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 payeeSearch.xhtml 中有一个扩展的数据表,显示为-

I have one extended Data Table in payeeSearch.xhtml displayed as -

1)单击显示详细信息后,它应导航到其他视图并根据所选行的列值之一获得的结果显示一个新表(在图中,是 IN303285 ... )
2)我编写了用于导航到下一个视图的代码-

1) After clicking on show particulars, it should navigate to a different view and display a new table based on the result achieved by one of the column's value of the selected row (In figure, it is IN303285...)
2) I have written code for navigating to the next view as -

<rich:contextMenu attached="false" id="menu" submitMode="ajax">
      <rich:menuItem ajaxSingle="true" value="Show Particulars" action="payeeParticulars.xhtml">
           <a4j:support event="onclick" actionListener="#{payeeSearchController.showParticulars}"/>
      </rich:menuItem>

3)此视图( payeeParticulars.xhtml )显示了另一个extendedDataTable.
并且 showPartulatrs actionlistener用于将所选行的列值传递给 PayeeParticulars.java 类,但是即使我能够将其始终传递空值,获取 payeeSearch.java 类中的值.
4)我正在编写代码以在 PayeeParticulars.java

3) This view (payeeParticulars.xhtml) is displaying another extendedDataTable.
And the showPartulatrs actionlistener is being used to pass the column's value of the selected row to PayeeParticulars.java class, But it is always passing the null value even though I am able to get the value in payeeSearch.java class.
4) I am writing code to display the new extendedDataTable in constructor of the PayeeParticulars.java class

谁能告诉我我要去哪里错了,或者如何将所选行的一列的值传递给另一种视图,并相应地在新的ExtendedDataTable中显示结果.

Can anybody tell me where I am going wrong, or how to pass the value of one column of the selected row to another view and display the result accordingly in a new extendedDataTable.

请帮帮我....

推荐答案

像这样使用rich:menuItem....

Use rich:menuItem like this....

<rich:menuItem submitMode="ajax" value="Show Particulars" action="#{payeeParticularsController.showParticular}"/>

然后在控制器文件中放入

and then in controller file put

public String showParticular()
{
   // operation
   return "details";
}

,然后在导航规则中将一个规则设置为-

and then in navigation rules set one rule as -

<navigation-rule>
    <from-view-id>/payeeSearch.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>details</from-outcome>
        <if>#{payeeParticularsController.selectedFolioNo != null}</if>
        <to-view-id>/payeeParticulars.xhtml</to-view-id>
    </navigation-case>
</navigation-rule>

它将允许您将值从一个类传递到另一个类,并且只有在满足if条件的情况下,才会加载新视图.

It will let you pass the value from one class to another and also new view will not be loaded until the if condition will be satisfied.

这篇关于jsf-2.0如何将值从一个类传递到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆