• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Spring-huangcheng
博客园    首页    新随笔    联系   管理    订阅  订阅

JSPX不同按钮调用同一个页面

在网页的页面上有时回存在几个不同的按钮,他们要调用到同一个页面来显示,那么我们应该怎么区分他们呢,又怎么根据不同需要作出不同的反应呢。

  下面一个是最近遇到的问题。

同样是调用同一个页面为什么点击edit时它有数据显示在一个页面,而点击add时它却没有数据?

因为当我们调用edit时,发生了以下动作:

  <jf:table id="comTable" var="row" value="#{roomCodePageBean.roomCodeList}" width="100%" rows="10" rowBandingInterval="1"

  binding="#{roomCodeHandler.comTable}" partialTriggers="comTable:rows comTable:editButton" immediate="true" autoSubmit="true" >

  <jf:column headerText="" sortable="true">

  <jf:commandButton id="editButton" text="#{res['btn.edit']}"

  immediate="true" partialSubmit="true" rendered="true"

  action="#{roomCodeHandler.initForm}">

  <jf:setActionListener from="#{row}" to="#{roomCodePageBean.roomCode}"/>

  //其中setActionListener具有把这行数据保存到一个对象里面的功能,在调到另外一个页面的时候,我们只需要用value="#{roomCodePageBean.roomCode.code}"既可以把该值

  //取到,当然也可以使用readOnly="true"把它设置为只读状态,另外还具有把数据保存到对象里面的功能,所以点击edit时就把数据保存到对象里面,点击add时就不需要啦

  //<jf:inputText id="name" value="#{roomCodePageBean.roomCode.code}" label="#{codeMainRes['authorisedSignatory.from.name']}"/>

  </jf:commandButton>

  </jf:column>

  而add却没有把数据传递过去

  <jx:navigationPaneEx

  hint="buttons" rendered="true" inlineStyle="text-align: right;width: 97%">

  <jf:commandNavigationItem id="addButton" text="#{res['btn.add']}"

  immediate="true" partialSubmit="true" rendered="true"

  action="#{roomCodeHandler.add}">

  </jf:commandNavigationItem>

  </jx:navigationPaneEx>

所以就是这个原因了

posted @ 2013-03-16 13:31  Spring-huangcheng  阅读(396)  评论(1)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3