dwr怎么获取java中的session

//--DWR取java中的session

import uk.ltd.getahead.dwr.WebContextFactory; (ctrl+shift+o 自动引入)

....

 

HttpSession  httpSession = WebContextFactory.get().getSession(); 

httpSession.getAttribute("USER_INFO")

 

//--jsp 向DWR传值

 <%
   Tynzpmanager userinfo = null;
    if (request.getSession().getAttribute("USER_INFO") != null) {
   userinfo = (Tynzpmanager) request.getSession().getAttribute(
     "USER_INFO");
%>

<script type="text/javascript">
    author = '<%=userinfo.getManagername()%>';
</script>

......

你可能感兴趣的:(JavaScript,java,jsp,DWR)