在我的项目中,我想实现当有人访问时,需要先弹出一个登录对话框(隐藏主页菜单和其他元素..让你看到登录框)。然后如果你输入正确的信息,隐藏登录框和显示布局给你。
现在的问题是:隐藏框时,是的,您可以看到布局并且看起来不错,但是当您单击菜单中的链接时,中心所有布局显示为无。但是当你再次刷新浏览器时,你又可以看到它了
我确定我是否更新了错误的 id 或其他东西。以下是代码引用和捕获异常。等待您的回答。对我很重要。最好的问候和感谢。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html">
<h:head>
<f:facet name="first">
<meta http-equiv="X-UA-Compatible" content="EmulateIE8" />
<meta content='text/html; charset=UTF-8' http-equiv="Content-Type" />
<title>SingTel - eshop Operation Maintaince</title>
<link rel="shortcut icon"
href="#{request.contextPath}/images/system/favicon.ico" />
</f:facet>
<link type="text/css" rel="stylesheet"
href="#{request.contextPath}/css/default.css" />
<link type="text/css" rel="stylesheet"
href="#{request.contextPath}/css/syntaxhighlighter/syntaxhighlighter.css" />
<style type="text/css">
</style>
<script type="text/javascript">
function handleLoginRequest(xhr, status, args) {
if(args.validationFailed || !args.loggedIn) {
jQuery('#dialog').effect("shake", { times:5 }, 100);
} else {
dlg.hide();
jQuery('#loginLink').fadeOut();
}
}
</script>
</h:head>
<h:body>
<p:outputPanel id="mainPanel" autoUpdate="true">
<p:layout fullPage="true" id="layout" rendered="#{esUserSessionBean.showLogin == true ? false : true}">
<p:layoutUnit id="left" position="west" closable="false"
collapsible="true" style="border:0px" header="MENU">
<h:form id="menuForm">
<p:slideMenu
style="width:272px;height:600px;margin-left:-3px;margin-top:-6px;"
id="tree">
<p:submenu label="Test EJB " icon="ui-icon-play">
<p:menuitem value="Test EJB " action="#{navigationBean.doNav}"
update=":centerContentPanel" icon="ui-icon-arrow-4-diag">
<f:param name="urlParam" value="ui/testEJB/testEJB" />
</p:menuitem>
</p:submenu>
</p:slideMenu>
</h:form>
</p:layoutUnit>
<p:layoutUnit id="center" position="center" style="border:0px;">
<p:outputPanel id="centerContentPanel">
<ui:include src="../#{navigationBean.pageName}.xhtml" />
</p:outputPanel>
</p:layoutUnit>
</p:layout>
</p:outputPanel>
<p:outputPanel id="loginPanel" autoUpdate="true">
<p:dialog id="dialog" header="Login" widgetVar="dlg" closable="false"
visible="#{esUserSessionBean.showLogin}"
modal="true"
>
<h:form id="loginForm">
<h:panelGrid columns="2" cellpadding="5">
<h:outputLabel for="username" value="Username:" />
<p:inputText id="username" value="#{esUserSessionBean.userId}"
required="true" label="username" />
<h:outputLabel for="password" value="Password:" />
<p:password id="password" value="#{esUserSessionBean.password}"
required="true" label="password" feedback="false" />
<f:facet name="footer">
<p:commandButton id="loginButton" value="Login"
actionListener="#{esUserSessionBean.login}"
oncomplete="handleLoginRequest(xhr, status, args) " />
</f:facet>
</h:panelGrid>
</h:form>
</p:dialog>
</p:outputPanel>
</h:body>
</f:view>
</html>