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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:22:18+00:00 2026-05-31T00:22:18+00:00

I need quite a simple solution to implement this. I need to store a

  • 0

I need quite a simple solution to implement this.

I need to store a value which I selected in JSF selectOneListbox drop down and need to preserve this value in bean. So everytime when user selects a new value, the one value I should be checking with new value in drop down. How best is this to do this using session?
Any java solutions to preserve the previous selected value?

I tried ValueChangeEvent oldValue is not working because my scope is request and that’s why I am looking for alternate methods.

My JSF version is 1.1

  • 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-31T00:22:19+00:00Added an answer on May 31, 2026 at 12:22 am

    Well, you can try this:

    <h:form>
        <h:inputHidden id="oldValue" value="#{mrBean.oldValue}" />
    
        <h:selectOneListBox id="newValue" value="#{mrBean.newValue}">
            ...
        <h:selectOneListBox>
    
        <h:commandButton actionListener="#{mrBean.doSomething}" value="Submit" />
    </h:form>
    

    Then you can access the old value this way:

    @RequestScoped
    @ManagedBean
    public class MrBean {
        private String oldValue;
        private String newValue;
    
        public void doSeomthing() {
           if (oldValue != null) {
               // Do whatever you need when oldValue is not null here
           } else {
               // 1st request will have oldValue == null
           }
    
           oldValue = newValue; // Update the oldValue with newValue
        }
    
        // Getters and Setters
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am about to do a homework, and i need to store quite a lot
The routing I need is quite simple, I must be missing something there. As
First of all, I'm sure there must be a simple solution to this but
I've run into this issue quite a few times and never liked the solution
This should be quite simple but I can`t fix it :/ I am using
I need to quickly implement a very small C or C++ TCP server/client solution.
I need to render quite alot (tens of thousands) images off-screen using OpenGL. I
I need to generate buttons initially based on quite a processor and disk intensive
I need to get up to speed with C++ quite quickly (I've never used
I need CEDET for eassist ( eassist-list-methods is quite handy). In eassist.el there's the

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.