gpt4 book ai didi

css - 重定向时同一页面布局的jsf差异

转载 作者:行者123 更新时间:2023-11-28 11:39:16 24 4
gpt4 key购买 nike

jsf 页面出现“奇怪”的情况。

我创建了一个 CustomNotFoundPage.xhtml,当用户点击一个不存在的页面时,网站会重定向到它。

此页面的输出与我点击 CustomNotFoundPage.xhtml 时的输出略有不同。

差异发生在我拥有的 div 上。我使用带有标题左侧菜单和主要内容的模板页面。

问题是标题 div 有点“高”,左侧菜单 div 与主要内容 div 卡在一起。

.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
template="./../Templates/mainTemplate.xhtml"
xmlns="http://www.w3.org/1999/xhtml">


<ui:define name="content">
<h2>The Requested page not Found</h2>

</ui:define>

</ui:composition>

标题CSS

root { 
display: block;
}

h1{
color : #ffffff ;
border-bottom-width: initial;
border-bottom-style: initial;
border-bottom-color: red;
font-size: 30px;
}

.HeaderCenter{
position: absolute;
top: 50%;
left: 50%;
width: 300px;
height: 36px;
margin-left: -150px;
margin-top: -15px;
}

CSS布局

#top {
position: relative;
background-color: #036fab;
color: white;
padding: 5px;
margin: 0px 0px 10px 0px;
}

#bottom {
position: relative;
background-color: #c2dfef;
padding: 5px;
margin: 10px 0px 0px 0px;
}

#left {
float: left;
}

#right {
float: right;
background-color: #ece3a5;
padding: 5px;
width: 150px;
}

.center_content {
position: relative;
background-color: #dddddd;
padding: 5px;
}

.left_content {
background-color: #dddddd;
padding: 5px;
margin-left: 180px;
}

.right_content {
background-color: #dddddd;
padding: 5px;
margin: 0px 170px 0px 170px;
}

#top a:link, #top a:visited {
color: white;
font-weight : bold;
text-decoration: none;
}

#top a:link:hover, #top a:visited:hover {
color: black;
font-weight : bold;
text-decoration : underline;
}

默认.css

body {
background-color: #ffffff;
font-size: 12px;
font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif;
color: #000000;
margin: 10px;
}

h1 {
font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif;
border-bottom: 1px solid #AFAFAF;
font-size: 16px;
font-weight: bold;
margin: 0px;
padding: 0px;
color: #D20005;
}

a:link, a:visited {
color: #045491;
font-weight : bold;
text-decoration: none;
}

a:link:hover, a:visited:hover {
color: #045491;
font-weight : bold;
text-decoration : underline;
}

最佳答案

最后我修好了。

在该部分的 web.xml 中

<error-page>  
<error-code>404</error-code>
<location>/faces/Secured/TestNotFound.xhtml</location>
</error-page>

我添加了参数“?faces-redirect=true”,现在可以正常工作了。我不能完全理解这个问题,但是从 Firefox 的 Firebug 我注意到,如果没有前面的参数,页面就会包含 notfoundpage.xhtml 的完整 html 代码

关于css - 重定向时同一页面布局的jsf差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20766002/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com