JSF 传递参数的问题

hurryin 2011-06-07 05:27:33
我现在有一个table,我想选择其中一个单选按钮,然后点击更新,对表进行操作,跳转到更新的页面,将我选中 的一行的内容传递给它。我该如何传递参数呢?代码如下
<rich:dataTable var="list" value="#{bumonlist}"
width="100%" rendered="#{sysB1WarDto.bumonlist.size>0}" id="main">
<f:facet name="header">
<rich:columnGroup>
<rich:column>
<h:outputText value="NO." />
</rich:column>
<rich:column>
<h:outputText value="ID" />
</rich:column>
<rich:column>
<h:outputText value="部門名" />
</rich:column>
<rich:column>
<h:outputText value="ステータス" />
</rich:column>
<rich:column>
<h:outputText value="選択" />
</rich:column>

</rich:columnGroup>
</f:facet>

<rich:columnGroup>

<rich:column>
<h:outputText value="#{list.rowNum}" />
</rich:column>

<rich:column>
<h:outputText value="#{list.bumonId}" />
</rich:column>
<rich:column>
<h:outputText value="#{list.bumonName}" />
</rich:column>

<rich:column>

<h:outputText value="#{list.bumonStatusName}">

</h:outputText>

</rich:column>

<rich:column>
<input type="radio" name="RadioGroup1" value="" onselect=""/>
</rich:column>




</rich:columnGroup>
</rich:dataTable></div>

<div style="margin-right: 40px; margin-top: 30px;" align="right">


<input value="更新 " type="button" class="button" onclick="showNewWindow('form1:update');"/>
<h:commandLink
id="update" action="#{sysB1Action.update}" style="visibility:hidden;"
onclick="window.open('','newWindow1_#{winNameSuffix}',
'width=550,height=400,navigation=yes,toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');"
target="newWindow1_#{winNameSuffix}">
</h:commandLink> <input value="追加 " type="button" class="button" onclick="showNewWindow('form1:newAdd');"/> <h:commandLink
id="newAdd" action="#{sysB1Action.add}" style="visibility:hidden;"
onclick="window.open('','newWindow2_#{winNameSuffix}',
'width=550,height=400,navigation=yes,toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');"
target="newWindow2_#{winNameSuffix}">
</h:commandLink>
...全文
52 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhangjun529 2011-06-07
  • 打赏
  • 举报
回复
我这几天也在自学jsf,这问题我也在研究,关注。。。
JSF实现文件的下载功能 public static void downloadFile(String path,String fileName) { try { // 获得JSF上下文环境 FacesContext context = FacesContext.getCurrentInstance(); // 获得ServletContext对象 ServletContext servletContext = (ServletContext) context .getExternalContext().getContext(); // 取得文件的绝对路径 String realName = servletContext.getRealPath(path) + "/" + fileName; HttpServletResponse httpServletResponse = (HttpServletResponse) FacesContext .getCurrentInstance().getExternalContext().getResponse(); downloadFile(httpServletResponse,realName,fileName); } catch (IOException e) { e.printStackTrace(); } FacesContext.getCurrentInstance().responseComplete(); } public static void downloadFile(HttpServletResponse response,String realName,String fileName) throws IOException { response.setHeader("Content-disposition", "attachment; filename=" + fileName); response.setContentType("application/x-download"); //File exportFile = new File(realName); //response.setContentLength((int) exportFile.length()); ServletOutputStream servletOutputStream = response.getOutputStream(); byte[] b = new byte[1024]; int i = 0; FileInputStream fis = new java.io.FileInputStream(realName); while ((i = fis.read(b)) > 0) { servletOutputStream.write(b, 0, i); } } 使用方法 1、在backing bean的方法中调用函数1即可。如Abean中download方法调用了该方法,前台可以这样调用: 或者 2、jsp页面可以这样调用: 于是jsf页面我们可以借助outputlink来调用该页面

51,397

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧