dwrsession:通过DWR使用JAVA的Session

 这是讲述如何通过DWR使用JAVASession例子想要通过DWR使用JAVASession如果您还没有引入DWRJAR包到工程中那么首先引入DWRJAR包到工程中随后就可以使用了在编写好正确JAVA代码后应该在dwr.xml发布要使用JAVA类随后重新启动JAVA服务器下面是发布配置:
  <!-- DwrSession - DwrSession --> 
  <create creator="" javascript="DwrSession">
  <param name="" value="您完整包名称.DwrSession"/>
  < method="getSessionId"/>
  < method="Session"/>
  < method="getSession"/>
  </create>





   JAVA类代码:

 
   import uk.ltd.getahead.dwr.*;
  public  DwrSession {
  //得到session编号
  public String getSessionId {
  WebContext webContext = WebContextFactory.get;
  webContext.getSession;
  webContext.getHttpServletRequest;
  webContext.getHttpServletResponse;
   webContext.getSession.getId;
  }
  public void Session(String value,String sessionName){
  WebContext webContext = WebContextFactory.get;
  //设定session值
  webContext.getSession.Attribute(sessionName, value);
  }
  public String getSession(String sessionName){
  WebContext webContext = WebContextFactory.get;
  //返回session值
   (String)webContext.getSession.getAttribute(sessionName);
  }
  }




="xspace-totlerecord">2="xspace-totlepages">1/2="xspace-current">12>
Tags:  dwr获得session dwrsession超时 dwr获取session dwrsession

延伸阅读

最新评论

发表评论