jsp - i dont know how to store a cookie value in java and pass then to html page i will use wicket concept in websession here -


code in java page

protected void onsubmit() {             system.out.println("login name inner submit function:"+this.loginname);          if(loginname == null || password == null) {             logger.error("login failed - login name " +                      (loginname!=null ? "is set (trimmed length=" +                              loginname.trim().length()+")" : "is null") +                      " , password " +                      (password!=null ? "is set" : "is null") + ".");             error(getlocalizer().getstring("login.error", null));             return;         }          user user = jtracapplication.get().authenticate(loginname, password);         system.out.println("user:"+user);         if (user == null) {             /*              * ================================              * login failed!              * ================================              */             logger.error("login failed - authentication login name '"+                     loginname + "' not successful");             error(getlocalizer().getstring("login.error", null));         } else {             /*              * ================================              * login success!              * ================================              */              /*              * set remember me cookie if checkbox checked on page.              */             if(rememberme) {                 cookie cookie = new cookie("jtrac", loginname + ":" + jtracapplication.get().getjtrac().encodecleartext(password));                 cookie.setmaxage(30 * 24 * 60 * 60); // 30 days in seconds                  string path = getwebrequestcycle().getwebrequest().gethttpservletrequest().getcontextpath();                 cookie.setpath(path);                 getwebrequestcycle().getwebresponse().addcookie(cookie);                 logger.debug("remember me requested, cookie added, " + webutils.getdebugstringforcookie(cookie));                 system.out.println("cookies:"+cookie);                 temp=cookie;             }              /*              * setup session principal              */             jtracsession.get().setuser(user);              /*              * proceed bookmarkable page or default dashboard              */             if (!continuetooriginaldestination()) {                 setresponsepage(dashboardpage.class);             }         }     } // end onsubmit() 

i dnt know how set cookie value in variable , pass html page,,, plz me possible.. use websession concept... thats y cant abl retrive session value in html page

hope these 2 links you.

  1. get/set cookie
  2. jsp - cookies handling

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -