Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6005083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:21:11+00:00 2026-05-23T01:21:11+00:00

iam getting error when initilize variable with value is from session.. my program like

  • 0

iam getting error when initilize variable with value is from session..
my program like this:

public class OTPController extends GenericForwardComposer implements Initiator{
    private String valueOTP;
    private Rusers user;
    public void doInit(Page arg0, Map arg1) throws Exception {
            user=(Rusers) arg1.get("user");
            System.out.println("user Id="+user);
    }

when i printout the value in init,the value is null..

if i take the session value like this:

    public void doInit(Page arg0, Map arg1) throws Exception {
            user=(Rusers) session.getAttribute("user");
            System.out.println("user Id="+user);
    }

the value is null too..

iam set the session like this:

session.setAttribute("user", user);

anybody can help me?iam very confuse,because if i hit the action after that null initialization and print out the result for example:

public void onClick$evaluate(Event event){
        String key=(String) session.getAttribute("key");
        if(valueOTP.equals(key)){ 
            System.out.println("user Id="+user);
            session.invalidate();
            session.setAttribute("user", user);
            execution.sendRedirect("./Welcome.zul");
        }else{
            System.out.println("OTP Failed");
            execution.sendRedirect("./Login.zul");
        }
    }

the value is show ,not null anymore..but if i init the variable,the value is null..anybody can help me?

thanks for your attention,and sorry for my bad english..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:21:12+00:00Added an answer on May 23, 2026 at 1:21 am

    i got naswer fro my question,and i want to share maybe somebody got same problem with me,simply change how you get the session object,like this:

    public void doInit(Page arg0, Map arg1) throws Exception {
                session=Executions.getCurrent().getSession();
                user=(user) session.getAttribute("user");
                System.out.println("user Id="+user);
        }
    

    the value is not null anymore..this is the right way to get the session object..thanks for your attention..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to define a public static variable like this : public :
I am getting this error now that I hit version number 1.256.0: Error 4
I am getting this error when trying to run internet information services on a
I am getting this error but only very occasionally. 99.9% of the time it
I am getting this error on a remote server, but the same code executes
I just wrote a new web part and now I am getting this error
It has been quite a while since I am getting this error in the
I am getting crazy over this error. Compiler is saying out of scope for
If I am getting an error on a function that a variable opcode may
I am getting this error, and am wondering if anyone has any idea how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.