JSF request参数传递
转载自:http://blog.csdn.net/duankaige/article/details/6711044
1:JSF页面之间传参
方法1:
<h:outputLink value="param2.jsf">
<h:outputText value="Test4"></h:outputText>
<f:param name="name" value="chen"></f:param>
<f:param name="id" value="123456"></f:param>
</h:outputLink>
方法2:
<h:outputLink value="param2.jsf?name=chen&id=123456">
<h:outputText value="Test4"></h:outputText>
</h:outputLink>
2:JSF页面之间取得参数
方法1:
<h:outputText value="#{param.name}"></h:outputText>
方法2:
<%=request.getParameter("name")%>
3:JSF页面到后台传参
<h:form>
<h:commandLink value="Test2" action="#{paramBean.test}">
<f:param name="name" value="zhang"></f:param>
<f:param name="id" value="123456"></f:param>
</h:commandLink>
</h:form>
4:JSF后台取得页面值
方法1:
HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
request.getParameter("name");
方法2:
Map varMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
varMap.get("id");
方法3:
通过配置文件进行Bean的属性值注入,在Bean的方法中直接使用属性
<managed-bean>
<managed-bean-name>paramBean</managed-bean-name>
<managed-bean-class>com.spg.bean.ParamBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>id</property-name>
<property-class>java.lang.String</property-class>
<value>#{param.id} </value>
</managed-property>
</managed-bean>
当前位置举例及相关总结
1:JS中可以使用java代码。获得当前Bean、获得当前Bean中属性值的java代码。
try{
parent.historyIframe.addHistory('/glp_user/glp_user_view_ViewForm.faces?<%=FacesContext.getCurrentInstance().getApplication().createValueBinding("#{glpUserForm.historyUrlParameter}").getValue(FacesContext.getCurrentInstance())%>','<%=LocaleMessage.getMessage("glpUser.glp_user_view_ViewForm.heading")%>(<%=FacesContext.getCurrentInstance().getApplication().createValueBinding("#{glpUserForm.glpUser.userName}").getValue(FacesContext.getCurrentInstance()) %>)',"1")
}catch(e){}
2:通过配置文件属性注入,param可以将页面上存入request的值放入后台的属性中。
public String getHistoryUrlParameter(){
if(this.glpUserPrimaryKey == null)
return "_key=" + this.glpUser.getUserId();
return "_key=" + this.glpUserPrimaryKey;
}
<managed-bean>
<managed-bean-name>glpUserForm</managed-bean-name>
<managed-bean-class>
cn.com.brilliance.begen.webapp.action.GlpUserForm
</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>glpUser</property-name>
<value>#{glpUser}</value>
</managed-property>
<managed-property>
<property-name>glpUserPrimaryKey</property-name>
<value>#{param._key}</value>
</managed-property>
</managed-bean>
JSF request参数传递的更多相关文章
- 02基于注解开发SpringMVC项目(jar包,异步,request,参数传递,多选的接收,Model传参,map传参,model传参,ajax,重定向,时间日期转换)
1 所需jar包 项目结构如下: 2 web.xml配置文件的内容如下: <?xmlversion="1.0"encoding="UTF-8"?&g ...
- Spring中获取request的几种方法,及其线程安全性分析
前言 本文将介绍在Spring MVC开发的web系统中,获取request对象的几种方法,并讨论其线程安全性. 原创不易,如果觉得文章对你有帮助,欢迎点赞.评论.文章有疏漏之处,欢迎批评指正. 欢迎 ...
- 【转】SpringMVC,获取request的几种方法,及线程安全性
作者丨编程迷思 https://www.cnblogs.com/kismetv/p/8757260.html 概述 在使用Spring MVC开发Web系统时,经常需要在处理请求时使用request对 ...
- [No000016E]Spring 中获取 request 的几种方法,及其线程安全性分析
前言 本文将介绍在Spring MVC开发的web系统中,获取request对象的几种方法,并讨论其线程安全性. 原创不易,如果觉得文章对你有帮助,欢迎点赞.评论.文章有疏漏之处,欢迎批评指正. 欢迎 ...
- Spring中获取request的几种方法,及其线程安全性分析(山东数漫江湖)
前言 本文将介绍在Spring MVC开发的web系统中,获取request对象的几种方法,并讨论其线程安全性. 原创不易,如果觉得文章对你有帮助,欢迎点赞.评论.文章有疏漏之处,欢迎批评指正. 欢迎 ...
- Spring中如何获取request的方法汇总及其线程安全性分析
前言 本文将介绍在Spring MVC开发的web系统中,获取request对象的几种方法,并讨论其线程安全性.下面话不多说了,来一起看看详细的介绍吧. 概述 在使用Spring MVC开发Web系统 ...
- 解决同一PC同一浏览器session共享问题
首先session是同一PC同一浏览器共享的.比如如下代码: public void doPost(HttpServletRequest request, HttpServletResponse re ...
- JavaWeb 之过滤器
1. 什么是过滤器 Servlet 是用来处理请求的, 过滤器是用来拦截请求的. 当用户请求某个 Servlet 时,会先执行部署在这个请求上的 Filter, 而 Filter 决定是否调用 Ser ...
- ajax-springMVC提交表单的方式
1.request参数提交(Form提交),适用于GET/POST request参数传递都会转换成 id=123&fileName=test.name&type=culture_ar ...
随机推荐
- vue中的css作用域、vue中的scoped坑点
一.css作用域 之前一直很困扰css的作用域问题,即使是模块化编程下,在对应的模块的js中import css进来,这个css仍然是全局的.导致在css中需要加上对应模块的html的id/class ...
- 是否 whether ,if
f,whether这两个词都能引出宾语从句,词义是“是否”. if 为口语体.有时两个词可以通用,但是当所引出的从句为介词宾语或不定式短语时,则只能用whether My wife wants to ...
- 字符串转成整型(int)
1 题目 Implement atoito convert a string to an integer. Hint: Carefullyconsider all possible input cas ...
- Java Drp项目实战—— 环境搭建
概要 我们要開始一个关于Java项目的开发,那么我们就须要搭建一个关于Java开发的环境,那么搭建一个Java开发环境,都须要些什么东东,又有些什么注意事项呢. 过程 我先将我搭建Java环境的软件和 ...
- ORCU浅析之安装和作用
众所周知,在安装Oracle BIEE之前需要安装Oracle RCU(Oracle Repository Creation Utility),美其名曰资料档案库.如果单单的从名称上来说,那就是我们实 ...
- iOS 本地通知 操作
iOS 本地通知 操作 1:配置通知:然后退出程序: UILocalNotification *localNotif = [[UILocalNotification alloc] init]; loc ...
- FLV视频播放:对未缓冲进度条实现拖动
FLV视频播放:对未缓冲进度条实现拖动 流媒体开发 Add comments 八282010 一.文件准备 1.转码:ffmpeg 2.添加元数据:yamdi 二.网页播放器:jw player 使 ...
- IOS8 Playground介绍
一.Playground介绍 Playground是Xcode6中自带的Swift代码开发环境.俗话说"功欲善其事,必先利其器".曾经在Xcode5中编写脚本代码,比如编写JS,其 ...
- TP5安装失败怎么办?
安装TP5遇到这样的错误 TP5安装失败怎么办? [Mon Mar 13 06:24:58.011228 2017] [:error] [pid 10243] [client 192.168.28.1 ...
- ERP,SCM,CRM,BRP,OMS,WMS 企业管理的6大核心系统
[导读]:人体共有八大系统:运动系统.神经系统.内分泌系统.循环系统.呼吸系统.消化系统.泌尿系统.生殖系统.这些系统协调配合,使人体内各种复杂的生命活动能够正常进行. 同理,企业要想健康的运转,长久 ...