Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF <f:event type="preRenderView" ...> works, but proper CSS isn't loaded
    text
    copied!<p>I am trying to check authentication on each view with the </p> <pre><code>&lt;f:event type="preRenderView" listener="{#loginControl.checkAuthentication}" /&gt; </code></pre> <p>tag. </p> <p>The mechanism works, but the look'n'feel is broken, it seems that there's some CSS missing. When I remove the check, my page is displayed as it should.</p> <p>This is one of my views, in which is check the authentication:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"&gt; &lt;f:event listener="#{loginControl.checkAuthorization}" type="preRenderView" /&gt; &lt;h:head&gt; ... </code></pre> <p>the following method is called:</p> <pre><code>public void checkAuthorization(ComponentSystemEvent evt){ FacesContext ctx = FacesContext.getCurrentInstance(); ConfigurableNavigationHandler nav = (ConfigurableNavigationHandler) ctx.getApplication().getNavigationHandler(); // navigate to login-screen if(this.user==null){ nav.performNavigation("login"); } else { nav.performNavigation("welcome"); } } </code></pre> <p>The output is this:</p> <p><a href="http://www.convince-it.de/Auswahl_002.jpeg" rel="nofollow">http://www.convince-it.de/Auswahl_002.jpeg</a></p> <p><a href="http://www.convince-it.de/Auswahl_003.jpeg" rel="nofollow">http://www.convince-it.de/Auswahl_003.jpeg</a></p> <p>As you can see the components are not rendered as they should when I check the authorization. The first picture is the screenshot of the view generated with authorization check enabled. The second view is the rendered view without authorization check, but with the wanted look.</p> <p>Any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload