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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:57:44+00:00 2026-05-23T04:57:44+00:00

I have main page that looks like this: <?xml version=’1.0′ encoding=’UTF-8′ ?> <!DOCTYPE html

  • 0

I have main page that looks like this:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
    <title>Facelet Title</title>
</h:head>
<h:body>
    <h:form>
        <p:panel id="panel">
            <ui:include src="#{bean.page}">
            </ui:include>
        </p:panel>
        <p:commandButton actionListener="#{bean.changePage}" value="Push" ajax="true" update="panel"/>
    </h:form>
</h:body>
</html>

What I want to do is have a bean like this and change dynamically which page is included. This is how bean looks like:

 @ManagedBean
 @SessionScoped
 public class Bean {
    private String page = "";

    public Bean() {
    }

    public String getPage() {
       return page;
    }

    public void setPage(String page) {
       this.page = page;
    }

    public void changePage(ActionEvent e) {
       page = "Page.xhtml";
    }   
}

When I click button Push I want this page to be included:

<?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:ui="http://java.sun.com/jsf/facelets">
   <h:head>
       <title>Facelet Title</title>
</h:head>
<h:body>
    <h:form>
        <ui:component>
            Hello from facelets
        </ui:component>
    </h:form>
</h:body>

Problem is that I have to press the button twice for page to be included. How can this be done so when I press the button the first time page is included?

  • 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-23T04:57:45+00:00Added an answer on May 23, 2026 at 4:57 am

    This kind of templating is normally achieved using the <ui:insert> and <ui:define> tags. Check out this page of the Java EE tutorial.

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

Sidebar

Related Questions

I have a simple HTML page that looks like this: ...<div id="main"> <a href="#">Click
I have a page that looks like this: Company A<br /> 123 Main St.<br
I have a main page that I want to be a sort of dispatch
I am working with a jquery plugin that looks like this: (function($){ var options;
Usually I have the main page (index.php) that include header/footer/menu and the content of
I have a main canvas 'blackboard' in a panel, this canvas has itself several
I have a main table that I must get data from. I have a
I have a main TCL proc that sources tons of other tcl procs in
I have an application where I have a main.m that returns NSApplicationMain(argc, (const char
I have a page with mp3s that are playable from a player, and there

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.