0

Java ページのコード

protected void onSubmit() {
            System.out.println("login name inner the 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") + 
                    " and 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 for login name '"+
                    loginName + "' not successful");
            error(getLocalizer().getString("login.error", null));
        } else {
            /*
             * ================================
             * Login success!
             * ================================
             */

            /*
             * Set Remember me cookie if checkbox is 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 with principal
             */
            JtracSession.get().setUser(user);

            /*
             * Proceed to bookmarkable page or default dashboard
             */
            if (!continueToOriginalDestination()) {
                setResponsePage(DashboardPage.class);
            }
        }
    } // end onSubmit()

クッキーの値を変数に設定し、それを自分の HTML ページに渡す方法がわかりません。できるだけ早く助けてください.. Web セッションの概念を使用します...つまり、html のセッション値を取得することはできません。ページ

4

1 に答える 1