CSS disappears after selecting menu in JSF application with PrimeFaces

Whenever I click on a p:menuitem and update the content of a layoutunit, the CSS style of the layoutunit disappears. Strangely, when I refresh the page, the style magically reappears. Can anyone explain why this happens?

<p:layout id="plantillaPrincipal" fullPage="true">
            <p:layoutUnit id="cabe" position="north">


                <h:form id="bmenu">

                    <p:menubar>

                        <p:menuitem id="inicio" value="INICIO" actionListener="#{controlMenu.mostrarOpcion()}" update=":container">
                            <f:setPropertyActionListener value="inicio" target="#{controlMenu.opcion}"/>
                        </p:menuitem>
                        <p:menuitem id="tarifas" value="TARIFAS" actionListener="#{controlMenu.mostrarOpcion()}" update=":container">
                            <f:setPropertyActionListener value="tarifas" target="#{controlMenu.opcion}"/>
                        </p:menuitem>
                        <p:menuitem id="tasas" value="TASAS" actionListener="#{controlMenu.mostrarOpcion()}" update=":container">
                            <f:setPropertyActionListener value="tasas" target="#{controlMenu.opcion}"/>
                        </p:menuitem>
                        <p:menuitem id="dudas" value="DUDAS" actionListener="#{controlMenu.mostrarOpcion()}" update=":container">
                            <f:setPropertyActionListener value="dudas" target="#{controlMenu.opcion}"/>
                        </p:menuitem>
                        <p:menuitem id="consultas" value="CONSULTAS" actionListener="#{controlMenu.mostrarOpcion()}" update=":container">
                            <f:setPropertyActionListener value="consultas" target="#{controlMenu.opcion}"/>
                        </p:menuitem>
                    </p:menubar>
                </h:form>
            </p:layoutUnit> 

            <p:layoutUnit id="container" position="center">
                <h:form id="fcont">
                    <ui:insert name="panelInicio">...</ui:insert>
                </h:form>
            </p:layoutUnit>

This is the content of layoutunit that needs to be updated:

...

This is the managed bean used for handling menu options:

...

Answer №1

When trying to update LayoutUnits, remember that they lack a renderer. A solution is to insert a placeholder such as OutputPanel within the unit and perform updates on it instead.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to align text within both the grid row and column while still maintaining the border?

When I apply justify-self and align-self rules, it successfully centers items vertically and horizontally. However, the issue arises when the borders wrap around the text instead of expanding all the way to the edges. My goal is to have a 1px border aroun ...

Facing difficulty with Sharepoint pop-up page while using Selenium Webdriver

Struggling to automate a Sharepoint site with Selenium Webdriver, as my code can't seem to locate elements on a new popup that appears. The scenario is this: in the script, there's a link leading to a new noticeboard item. When clicked, it trigg ...

Auto play feature malfunctioning in Onsen-UI Carousel attribute settings

When utilizing onsen UI in my mobile web application, I encountered an issue with the autoplay property not functioning properly within the carousel. <ons-page> <ons-toolbar> <div class="left"> <ons-toolbar-button on ...

Incorporate an animated loading GIF image within the ajaxStart function, dynamically appending it within a div tag

Is there a way to dynamically display a loading GIF image on all HTML web pages? var loading = $(' <div id="loading"> <img src="../img/loading%20(1).gif" id="loading-image" alt="Loading..." /> </div>'); $(document).ajaxStart( ...

choose a selection hopscotch

Is there a way to prevent the input field from jumping out of alignment when an option is selected in these q-select inputs? I want to fix this issue so that the field remains in line with the horizontal alignment. https://codepen.io/kiggs1881/pen/RwENYEX ...

Continue scrolling once you reach the fixed-positioned div

live demo html <div class="one"></div> <div class="two"></div> <div class="three"></div> <div class="four"></div> css .container{ margin: 0; padding: 0; ...

Activating text wrapping functionality

My current project involves converting HTML to PDF using jsPDF. In order to ensure that every word appears in the exact location as it does in the original HTML, I decided to wrap each word in <span> tags. Specifically, I have a font tag (not added b ...

What is the best way to ensure my footer remains at the bottom of the page even when scrolled?

I'm struggling to get my footer to stay at the bottom of a page that requires scrolling. The code I have only seems to work on pages without scrolling, causing the footer to display in the middle of the page instead of at the bottom where it belongs. ...

The styling of Div remains unchanged by CSS

Currently, I am working on a website using HTML and CSS. I have created a division element and applied a class to it called profile_pic. However, when I make changes to this class in the CSS file, it does not reflect on the div. It seems like the styling ...

"Triggering CSS changes with the click of a

I am developing a basic calendar application in PHP and I would like to dynamically change the style of the <td> block based on user interactions. Specifically, I want to implement a behavior where once the "menuclick" class is active, the other cl ...

What could be causing the failure of the update for this computed property in my Vue 3 application?

Currently, I am in the process of creating an audio player using Vue 3 and the Napster API. About the Project I have managed to make the vinyl rotate by utilizing a CSS keyframes-based animation paired with the computed property isSpinning. I intend for ...

Struggling to create responsive embedded videos?

I have successfully created a responsive video, but there seems to be an issue with the width to height ratio when the browser is fully stretched. The iframe appears narrow and tall in this situation. However, when the browser is resized and the video move ...

Click to reveal sliding menu bar

Trying to create a sliding menu bar (.top-bar) that activates when clicking an arrow (#hide), causing the arrow to also slide up and switch from an up arrow to a down arrow. Here is my unsuccessful attempt: $(document).ready(function(){ $("#hide").c ...

Mobile display exhibiting glitches in animation performance

I have implemented an animation in the provided code snippet. const logo = document.querySelector('.logo'); const buttons = document.querySelectorAll('.loadclass'); const html = document.querySelector('html') const cornerme ...

Instructions on setting div opacity when Overflow is set to visibleExplanation on setting opacity for div with Overflow

In my HTML code, I have a div element and an image tag stacked one on top of the other. The div is smaller than the image. I have set the overflow property to visible for the div. My query is, when I add an image to the image tag, the content that overflow ...

Show the cell data when the checkbox next to it is selected

I have a specific table setup and I am trying to display the content of the table cell if its corresponding checkbox is checked upon clicking a button. For example: If Row2 is checked, an alert box should display Row2 Below is my code snippet, Java ...

Creating an overlay effect when hovering over an image

Recently, I've been working on a gallery of photos that showcases different individuals. My goal is to have information about each person displayed when their respective photo is hovered over - including their name and role. .gallery { position: ...

Add additional text using the ::after pseudo-element exclusively for a particular class

Here is the HTML code snippet I am currently working with: <style> p::after { content: "%"; } </style> <div class="counter-box"> <p data-value="185">100</p> </div> At present, my CSS applies text injection to ...

Locate button elements with the class "button" that do not have any images inside them

Below is the code I am currently using for buttons (I prefer not to change it): <a href="#" class="button"> Button text <img src="someimage.png" /> </a> This CSS styled code creates a sleek button with an icon. To round the left sid ...

Issue with cursor behavior in contenteditable field on Chrome

Recently, I encountered an issue where the cursor would jump to the wrong place when a user clicked inside a contenteditable div, but not directly on the text. This problem seems to be isolated to newer versions of Chrome and Opera. Interestingly, when I t ...