使用 af:setActionListener 显式赋值

< af:setActionListener >

The setActionListener tag is a declarative way to allow an action source ( < commandButton > , < commandLink > , etc.) to set a value before navigation. It is perhaps most useful in conjunction with the "processScope" EL scope provided by ADF Faces, as it makes it possible to pass details from one page to another without writing any Java code. This tag can be used both with ADF Faces commands and JSF standard tags. More generally, it can be used with any component at all that implements the standard ActionSource interface.

setActionListener标签提供了一条显式途径,给EL表达式设置值,在实现了实现了actionSource接口的控件( < commandButton > , < commandLink > , etc.)都可以使用.既可以在ADF faces 组件上使用,也可以在标准的JSB标签上使用.这样就可以在页面之间传递数据而不用写任何代码

 Example: This example shows a table with a "Show..." button. When the button is pressed, the following will happen: The value of "#{row}" will be retrieved - which corresponds to the current row in the table. That object will get stored as the "detail" property in process scope. The user will navigate to the "showDetail" outcome of this page (because of the "action" property on the < h:commandButton > ). The target page can then retrieve the detail object from the process scope and use it as needed.            

   <h:dataTable var="row" value="#{....}">
              ...
              <h:column>
                <h:commandButton value="Show..." action="showDetail" ..>
                  <af:setActionListener from="#{row}"
                                        to="#{processScope.detail}"/>
                </h:commandButton>
              </h:column>
  </h:dataTable>

      

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
PlantUML 是一种基于文本的 UML 工具,它支持多种 UML 图形的绘制,包括创建界面的代码。下面是一个例子,展示了如何使用 PlantUML 来表示创建一个简单的登录界面的代码: ``` @startuml class LoginScreen { -usernameField: TextField -passwordField: PasswordField -loginButton: Button -cancelButton: Button +login(username: String, password: String): void +cancel(): void } class TextField { +getText(): String +setText(text: String): void } class PasswordField { +getPassword(): char[] } class Button { +setText(text: String): void +setActionListener(listener: ActionListener): void } interface ActionListener { +actionPerformed(event: ActionEvent): void } class LoginController { -screen: LoginScreen +LoginController(screen: LoginScreen) +login(): void +cancel(): void } LoginScreen -> TextField LoginScreen -> PasswordField LoginScreen -> Button LoginScreen -> ActionListener LoginController -down-> LoginScreen @enduml ``` 这段代码定义了一个名为 LoginScreen 的类,它包含了四个私有成员变量:usernameField、passwordField、loginButton 和 cancelButton。它还定义了两个公有方法 login 和 cancel,用于处理用户登录和取消操作。 除此之外,这段代码还定义了另外三个类:TextField、PasswordField 和 Button,以及一个接口 ActionListener。最后,还定义了一个名为 LoginController 的类,用于控制登录界面的行为。 通过这段代码,你可以清楚地看到如何使用 PlantUML 来表示创建界面的代码,并且可以使用它来生成 UML 图形。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值