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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:57:02+00:00 2026-06-17T12:57:02+00:00

I have backing bean like this: @ManagedBean @SessionScoped public class TestBean { private String

  • 0

I have backing bean like this:

@ManagedBean
@SessionScoped
public class TestBean {

    private String testString;

    public String getTestString() {
        return testString;
    }

    public void setTestString(String testString) {
        this.testString = testString;
    }
}

And my xhtml page pretty simple too:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"    
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      >

    <h:head></h:head>

    <h:body>

        <h:form>
            <h:inputText value="#{testBean.testString}"/>
            <h:commandButton action="#{testController.testAction}"/>
        </h:form>

    </h:body>

 </html>

Everything I want – to render my h:inputText element without value (empty).
I’m new to JSF, so, could you help me?
With best regards!

UPD!
It’s simplified code, I’m using testString in other places and testString have value, which I want to hide! And I want to keep this value.

  • 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-17T12:57:03+00:00Added an answer on June 17, 2026 at 12:57 pm

    Provided that it’s really a request/view scoped bean, you’re likely victim of browser’s builtin autocomplete/autofill feature. You can turn it off by adding autocomplete="off" to the input component in question.

    <h:inputText ... autocomplete="off" />
    

    Note again that it’s not JSF who has filled the inputs, but the webbrowser itself. Clear the browser cache and you’ll see that the browser won’t do it anymore. Depending on browser make/version you can also reconfigure it to autocomplete a bit less eagerly.


    Update: as per your question update, your bean turns out to be session scoped. This is not the normal scope for request/view based forms. A session scoped bean instance is shared across all browser windows/tabs (read: all requests/views) in the same HTTP session. You usually store only the logged-in user and its preferences (language, etc) in the session. You will only get a brand new instance when you shutdown and restart the entire browser, or use a different browser/machine.

    Change it to be request or view scoped. In this particular simple example, the request scope should suffice:

    @ManagedBean
    @RequestScoped
    

    See also:

    • How to choose the right bean scope?

    Update 2 based on the comment,

    Oh, you right, it’s better for me to use @RequestScoped. But it doesn’t resolve my problem – I want to keep this value, but I don;t want to show it in textInput. This value is important in context of request-response cycle.

    the concrete functional requirement is now much more clear (in future questions, please pay attention to that while preparing the question, I had no idea that you was initially asking it like that). In that case, use a view scoped bean with 2 properties like this:

    @ManagedBean
    @ViewScoped
    public class TestBean {
    
        private String testString;
        private String savedTestString;
    
        public void testAction() {
            savedTestString = testString;
            testString = null;
        }
    
        // ...
    }
    

    You can alternatively also store it in the database or a property of an injected managed bean which is in turn actually in the session scope, for example.

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

Sidebar

Related Questions

I have a property in my backing bean that returns html code: public String
Here is my Problem: Backing bean is @SessionScoped I have a p:dataTable with selectionMode
I have a backing bean, and I'd like to load up a few lists
I have a backing bean containing this object: List<Session> sessions; and a Session is
I have an xhtml file, with a backing bean, i'd like to create a
I have a list of objects in backing bean and I would like to
I have Facelet component and I have backing bean for it. When I include
I have a problem with selectInputDate: I have a backing bean which I am
So, I have a backing bean, Foo, and a template with a client, request
I have two drop downs on a page whose backing bean is Request Scoped.

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.