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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:37:04+00:00 2026-05-23T10:37:04+00:00

I have a menubar in which two items on a submenu, both calling the

  • 0

I have a menubar in which two items on a submenu, both calling the same page:

<p:menubar autoSubmenuDisplay="true">  
   <p:submenu label="Perfil">  
       <p:menuitem value="Editar" url="perfil.xhtml" />  
       <p:menuitem value="Ver" url="perfil.xhtml" />  
   </p:submenu>  
</p:menubar>  

In that page i have a tabview with two tabs:

<p:tabView dynamic="true">  
    <p:tab id="ver" title="Ver perfil">  
        <ui:include src="verPerfil.xhtml" />    
    </p:tab>  
    <p:tab id="editar" title="Editar perfil">   
    <ui:include src="editarPerfil.xhtml" />  
    </p:tab>  
</p:tabView>  

How can i set the active tab, so each menuitem activate the corresponding tab?

  • 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-23T10:37:05+00:00Added an answer on May 23, 2026 at 10:37 am

    If you want to do this.You can’t use the url in the p:menuitem because we must call a method to changing the tabindex before skipping to the prefil.xhtml page. If you use the url, the method will be invoked after we skip to the prefil.xhtml page .

    First, you can use the action field of the p:menuitem, the method returns the address you want to skip to:

    <p:menubar autoSubmenuDisplay="true">  
        <p:submenu label="Perfil">  
            <p:menuitem value="Editar" action="#{some.editar}" ajax="false"/>  
            <p:menuitem value="Ver" action="#{some.ver}" ajax="false" />  
        </p:submenu>  
    </p:menubar> 
    

    These two method do something to change the tabindex like this:

    public String editar() {
        tabindex = 0;
        return "verPerfil";
    }
    
    public String ver() {
        tabindex = 1;
        return "verPerfil";
    }
    

    Then the p:tabView has an attribute named activeIndex. It is the index of the active tab, its default value is 0. So you can do as follows:

    <p:tabView dynamic="true" activeIndex="#{some.tabindex}" >
        <p:tab id="ver" title="Ver perfil">
            <ui:include src="verPerfil.xhtml" />
        </p:tab>
        <p:tab id="editar" title="Editar perfil">   
            <ui:include src="editarPerfil.xhtml" />
        </p:tab>
    </p:tabView>
    

    Then each menuitem will activate the corresponding tab.

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

Sidebar

Related Questions

I have an unordered list I'm displaying horizontally as the page's top menubar. I've
I have a MenuBar, which is using a XMLListCollection object as a dataProvider. I
I have found a problem. When i click on HorizontalLayout (which contains MenuBar) then
I need some assistance from the Flex experts. I have an mx:Menubar , which
I suddenly have Run and Search in the menubar of my RCP application. Is
I have created an application that has a toolbar, menubar and content area. I
I have a menu bar that is rotated slightly. Here are two buttons as
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have some pages that have content that is relevant to both logged in
I have a WPF application which has a main window composed from several custom

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.