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 9098225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:18:40+00:00 2026-06-17T00:18:40+00:00

Background information: I have a file upload applet in my jsf page. This applet

  • 0

Background information: I have a file upload applet in my jsf page. This applet expects an adress where it can send it’s POST request. (I can’t edit this post request to add more fields or something). The post method of my servlet then stores the file. This job can’t be done by a managed bean because the servlet has to be annotated with @MultiPartConfig and I can’t add this annotation to the jsf managed bean. In order to force the upload applet to use the same session I added an URL attribute named jsessionId to the post request according to this post. In my servlet I am now able to access session scoped beans.

Now I have a ViewScoped bean where I store some form input data which I want to use in the servlet, since adding those inputs to the post request doesn’t work (Applet is a third party project (JUploadApplet) and for some reason it doesn’t work to add additional form data).
Now is it possible to access the ViewScoped bean from within the servlet ? If I change the scope into SessionScope I am able to process the input but with ViewScoped I get a NullPointerException if I try to access the bean like this :
UploadBean uploadBean = (UploadBean)request.getSession().getAttribute(“uploadBean”);

  • 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-17T00:18:42+00:00Added an answer on June 17, 2026 at 12:18 am

    This is not possible. Your best bet is to let the view scoped bean generate an unique key, store itself in the session scope by that key and pass that key as additional parameter to the applet and finally let the servlet access the session attribute by that key.

    E.g.

    private String sessionKey;
    
    @PostConstruct
    public void init() {
        sessionKey = UUID.randomUUID().toString();
        FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(sessionKey, this);
    }
    
    @PreDestroy
    public void destroy() {
        FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove(sessionKey);
    }
    

    Let the applet pass the sessionKey as request parameter to the servlet, so that the servlet can do

    String sessionKey = request.getParameter("sessionKey");
    Bean bean = (Bean) request.getSession().getAttribute(sessionKey);
    // ...
    

    Note that instead of the bean itself, you can also just store an arbitrary bean/valueobject/etc.

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

Sidebar

Related Questions

I've been fighting this all day. Inside my styles.xml file I have color information
Background Information: I have a single Window VPS at example.com. I have it running
I have a python script that can run for long time in the background,
First some background information: We have three environments for our EJB3 application: test, development
I've got some Java Applet that I'd like to use to upload file/files to
I have a feature file like this Feature: search for movies by director As
Background The idea is this: Person provides contact information for online book purchase Book,
Background information: I have been writing code to control a device attached by a
so first I'll give some background information so you can understand my problem completely.
Background I have an ASP.NET web application with a VB.NET back end. In this

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.