简体   繁体   中英

Transform jsp to java code

I need java code for this jsp line code. I know how to make it for scope "page" or "application" but i really dont know how it works with "session"

<jsp:useBean id=”pera” class=”beans.User” scope=”sesion”>

This is Solution.

beans.User user = null;

synchronized (application) {

  user = (beans.User) _jspx_page_context.getAttribute("user", 
PageContext.APPLICATION_SCOPE);

  if (user == null){

    user = new beans.User();

    _jspx_page_context.setAttribute("user", user, 
PageContext.APPLICATION_SCOPE);

  }

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM