获取RequestContext和SessionContext数据区节点的数据

 
1. RequestContext设在展现逻辑构件中往DOM中存放了数据:
test1
test2
 
在JSP中访问DOM数据:
<%
com.primeton.tp.core.prservice.context.RequestContext reqContext = (com.primeton.tp.core.prservice.context.RequestContext) request.getAttribute(com.primeton.tp.web.driver.webdriver.WebDriver.REQUEST_REQUEST_CONTEXT);
 
//获取list/Test[@id="1"] 节点
org.w3c.dom.Element testElt = (org.w3c.dom.Element)reqContext.getEntity("list/Test[@id=/"1/"] ") ;
 
//获取list/Test[@id="1"]/name的节点值test1
String nameValue = reqContext.getEntityValue("list/Test[@id=/"1/"]/name") ;
 
//获取多个name节点的值,返回数组{" test1 " ," test2 "}
String[] names = reqContext.getArrayProperty("list/Test/name") ;
%>
2. SessionContext数据区(如上一样)
<%@ page import="com.primeton.tp.core.prservice.context.*"%>
<%
SessionContext sctx = (SessionContext)session.getAttribute(com.primeton.tp.web.driver.webdriver.WebDriver.SESSION_CONTEXT);
String logname = sctx.getEntityValue("UserLoginSession")+"";
%> 

你可能感兴趣的:(普元的EOS平台)