I have a primefaces web application running on tomcat 8. In META-INF/context.xml
I defined the following:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/syslac"/>
While in my view xhtml page I have this fragment code where p:commandButton has a oncomplete tag that will execute the handleLoginRequest function.
<h:form>
<h:panelGrid columns="2" cellpadding="5">
<h:outputLabel for="username" value="Usuario:" />
<p:inputText value="#{loginBean.usuarioVendedor.usuarioSistema}" id="username" required="true" label="username" />
<h:outputLabel for="password" value="Contrasena:" />
<h:inputSecret value="#{loginBean.usuarioVendedor.clave}" id="password" required="true" label="password" />
<f:facet name="footer">
<p:commandButton value="Ingresar" update=":growl" actionListener="#{loginBean.loguearse}" oncomplete="handleLoginRequest(xhr, status, args)" />
</f:facet>
</h:panelGrid>
</h:form>
The script:
<script type="text/javascript">function handleLoginRequest(xhr, status, args)
{
if (args.validationFailed || !args.loggedIn) {
jQuery('#dialog').effect("shake", {times: 2}, 100);
} else {
dlg.hide();
jQuery('#loginLink').fadeOut();
window.location = args.view;
}
}
</script>
But I can not retrieve the context path from META-INF/context.xml
through logginBean so that I can send view arg to be used by window.location in navigation: /syslac/page.xhtml
where syslac is context path of the application.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…