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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:03:04+00:00 2026-06-09T04:03:04+00:00

hi chums I am new to JSF and I got stuck in JSF problem.I

  • 0

hi chums I am new to JSF and I got stuck in JSF problem.I want to add dynamically my content in my JSF page.My requirment is that I have one facelets which I have to add in my page after some event.

My page contains

two fields ‘user name’ and ‘answer’
and
two buttons ‘login’ and ‘recover password’

Facelet contains

a field and just a button

Now I want that when I run my this page it should show only Page contents(described above)
and if user press the button 'recover password' then it should show the facelet under the components of page on the same page mean after pressing the button , page could include facelet.
But now when I run my code it show both as I haven’t put any logic to add 2nd facelet dynamically.
Here a patch of my code given below

 <h:inputText id="txtLogin" styleClass="textEntry" required="true" requiredMessage="Username is required."> 
                    </h:inputText>
<h:inputText id="answer" styleClass="textEntry" autocomplete="off" required="true" requiredMessage="Answer is required."></h:inputText>
                                    <h:commandButton id="btnSave" value="Save" styleClass="formbutton" onclick="btnSave_Click" />
                    <h:commandButton id="btnRecover" value="Recover" styleClass="formbutton" onclick="btnRecover_Click"/>

Now I want when this btnRecover_click click then it include this facelet or run this code

<div class="divPadding">
            <ui:include id="passrecov" src="ucPasswordRecovery.xhtml" rendered="false"/>
        </div>

Keep in mind that I have to do this with JSF and don’t want to do this with JavaScript

Thanks

  • 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-09T04:03:05+00:00Added an answer on June 9, 2026 at 4:03 am

    I’ll post a sample using with 1 column, remember that you could use another ui container.

    <h:form>
        <h:panelGrid id="login">
            <h:panelGrid>
                <h:inputText id="txtLogin" styleClass="textEntry" required="true"
                    requiredMessage="Username is required."> 
                </h:inputText>
                <h:inputText id="answer" styleClass="textEntry" autocomplete="off"
                    required="true" requiredMessage="Answer is required.">
                </h:inputText>
                <h:commandButton id="btnSave" value="Save" styleClass="formbutton"
                    onclick="btnSave_Click" />
                <h:commandButton id="btnRecover" value="Recover" styleClass="formbutton"
                    action="#{loginBean.showPassRecovery}" />
            </h:panelGrid>
        </h:panelGrid>
    
        <h:panelGrid id="passRecovery">
            <h:panelGrid rendered="#{not loginBean.loginEnabled}">
            <ui:include id="passrecov" src="ucPasswordRecovery.xhtml" />
            </h:panelGrid>
        </h:panelGrid>
    </h:form>
    

    And your managed bean:

    @ManagedBean
    @ViewScoped
    public class LoginBean {
        private boolean loginEnabled;
    
        public LoginBean() {
            loginEnabled = true;
        }
    
        //getters and setters...
    
        //this method will return void, so the page will be refreshed with the new
        //loginEnabled value. this time the components inside "login" panelGrid won't be rendered
        //but "passRecovery" panelGrid components will.
        public void showPassRecovery() {
            loginEnabled = false;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add some processing logic to a program that chugs away on
I'm trying to add a column to the end of my results that shows
I would like to use a different ArrayList for the content of a table
I have dropdown lists in two forms in a single .jsp. I would like
I've been looking at the problem of writing a concurrent Multimap , and I
Just wondering, if I statically create an object that has a pointer as a
So I have a map with a heap of MKPolygonViews overlaid. When I put
I have following HTML structure: <div> <h2>Candy jelly-o jelly beans gummies lollipop</h2> <p> Cupcake
I'm trying to install Rakudo Star on OS X 10.6, and I've reached the
I am, for some time, experimenting with LLVM , simply because. It does, however,

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.