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

  • Home
  • SEARCH
  • 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 8170537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:09:24+00:00 2026-06-06T21:09:24+00:00

Background : I am having backing bean which has upload method that listen when

  • 0
  • Background :

I am having backing bean which has upload method that listen when file is uploaded. Now I pass this file to parser and in parser am doing validation check for row present in csv file.

If validation fails, I have to log information and saving in logging table in database.

  • My end goal :

Is to get session information in logging bean so that I can get initialContext and make call to ejb to save data to database.

  • What is happening :

In my upload backing bean, am getting session but when i call parser, I do not pass session information as I do not want parser to be dependent on session as I want to unit test parser individually.

So in my parser, I do not have session information, from parser am making call to logging bean(just a bean with some ejb methods) but in this logging bean, i need session because i need to get initial context.

Question

  1. Is there a way in JSF, that I can get the session in my logging
    bean
    that I have in my upload backing bean?

I tried doing:

FacesContext ctx = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) ctx.getExternalContext().getSession(false);

but session value was null, more generic question would be :

  1. How can I get session information in model bean or other beans that
    are referenced from backing beans in which we have session?
  2. Do we have generic method in jsf using which we can access session
    information throughout JSF Application?
  • 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-06-06T21:09:25+00:00Added an answer on June 6, 2026 at 9:09 pm

    So what i did to get around this,

    I saved parameters as query string from xhtml like from status.xhtml

    <h:link outcome="Log" value="${result.id}">
                    <f:param name="jobid" value="${result.id}"/>
                    <f:param name="userid" value="${result.userId}"/>
                </h:link>
    

    now in my log.xhtml, i have

    <f:metadata>
    <f:viewParam name="jobid" value="#{bean.jobId}"/>
    <f:viewParam name="userid" value="#{bean.userId}"/>
    </f:metadata>
    

    and in my log bean i have,

    public void init()
        {
            String userId1 = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("userid");
            String jobId1 = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("jobid");
            userId = Long.parseLong(userId1);
            jobId = Long.parseLong(jobId1);
    
        }
    

    Reference: Processing Get Parameters

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

Sidebar

Related Questions

Having a background in Java, which is very verbose and strict, I find the
I'm having troubles setting the background color for JButtons. For example I get this
Here is a little background information. I'm working on replacing a dll that has
Having XNA background, I try to create a simple DirectX11 application. Now I try
In android generally for buttons having different background are stored in a xml file
I currently can only playback my background sound from having my wave file next
This should be an easy question for many of you! Background: I am having
I'm having some problems trying to get a background upload system working using WebWorkers
Background I'm having a bit of trouble finding out just how to programmatically post
The background: I'm having some problems with Thoughtbot's Factory Girl gem, with is used

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.