jsp中的session在java文件中取到

jsp页面调用.mxml页面,然后.mxml页面调用后台java文件,在后台java文件中通过session 可以取道jsp页面中的session的值.

 

<%@ page language="java" import="java.util.*,com.xbzc.phr.service.login.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  <body>
  
<%

String sid = request.getParameter("systemId");  //市级平台上注册的系统ID
String pwd = request.getParameter("password");  //市级平台上注册的系统密码
String did = request.getParameter("doctorUserId");  //医生ID
String dname = new String(request.getParameter("doctorUserName").getBytes("ISO-8859-1"));  //医生姓名
String unid = request.getParameter("uniqueId");  //患者注册的唯一内部标识
String idtype = request.getParameter("idTypeCode");  //患者注册的唯一内部标识类型
String vipo = request.getParameter("userRole");  // 查看角色viewPole
String vitar = request.getParameter("purposeOfRuse"); //查看目的viewTarget

String patiName = request.getParameter("patientName"); 
String patiSex = request.getParameter("patientSex");  
String patiBirthDate = request.getParameter("patientBirthDate"); 

session.setAttribute("doctorUserId",did);   // 医生ID
session.setAttribute("doctorUserName",dname);   // 医生姓名
session.setAttribute("uniqueId",unid);   // 患者注册的唯一内部标识
session.setAttribute("idTypeCode",idtype);   // 患者注册的唯一内部标识
session.setAttribute("systemId",sid);   // 市级平台上注册的系统ID
session.setAttribute("password",pwd);   // 市级平台上注册的系统密码
session.setAttribute("viewPole",vipo);  // 查看角色
session.setAttribute("viewTarget",vitar); //查看目的
session.setAttribute("patientName",patiName);
session.setAttribute("patientSex",patiSex);
session.setAttribute("patientBirthDate",patiBirthDate);

%>
	<jsp:forward page="PHBEMR.html"/>

  </body>
</html>


上面的PHBEMR.html 其实是 PHBEMR.mxml,在 PHBEMR.mxml中调用了后台的java,

public RPCMessage getURLParameter() {
		log.info("服务层操作:返回第三方传过来的参数,第三方设置的参数在index.jsp中  getURLParameter()");
		// log.info("验证[" + userId + "]共享信息");
		HttpServletRequest request = FlexContext.getHttpRequest();
		HttpSession session = request.getSession();
		List<TURLParameterDTO> urlParameterList = new ArrayList<TURLParameterDTO>();
		// Map<String,TURLParameterDTO> map = new
		// HashMap<String,TURLParameterDTO>();
		TURLParameterDTO o = null;
		String idNumber = "";
		String idTypeCode = "";
		String uniqueId = (String) SessionUtils.getAttribute("uniqueId");
		try {
			Enumeration<String> enumeration = (Enumeration<String>) session
					.getAttributeNames();
			String attributeName;
			while (enumeration.hasMoreElements()) {
				attributeName = enumeration.nextElement().toString();
				if (("__flexSession".equals(attributeName))
						|| ("currentuser".equals(attributeName)))
					continue;

				o = new TURLParameterDTO();
				o.setPropertykey(attributeName);
				o.setPropertyvalue((String) session.getAttribute(attributeName));


上面的代码中拿到了session中的值.

 

=============================================

 

flex调用java也存在request请求,

HttpServletRequest request = FlexContext.getHttpRequest();  //   flex.messaging.FlexContext

然后通过request能拿到session

HttpSession session = request.getSession();   //  javax.servlet.http.HttpSession

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值