- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我的 xhtml 页面,我在其中使用 JSF 框架,当我在项目之外尝试此代码时,它正在工作,但是当我尝试与我的 html View 集成时,它不起作用,请帮我解决这个问题
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>EDPMS Process</title>
<link rel="stylesheet" href="css/jquery-ui.css" />
<link rel="stylesheet" href="css/style.css" />
<link href="css/datepicker.css" rel="stylesheet" />
<link type="text/css" rel="stylesheet" href="css/bootstrap.css" />
<link type="text/css" rel="stylesheet" href="css/bootstrap-dropdown.css" />
<link type="text/css" rel="stylesheet" href="css/headfoot.css" />
<link href="css/font-awesome.css" rel="stylesheet" />
<script src="js/jquery-1.9.1.js" type=""></script>
<script src="js/jquery-ui.js" type=""></script>
<script src="js/bootstrap.js" type="text/javascript"></script>
<script src="src/main/webapp/js/bootstrap-datepicker.js" type="text/javascript"></script>
<script src="js/bootstrap-datepicker.js" type="text/javascript"> </script>
<script type="text/javascript" src="js/jquery.cookie.min.js"></script>
<script type="text/javascript" src="js/jquery.collapsible.min.js"></script>
<script type="text/javascript" src="js/highlight.pack.js"></script>
<script type="text/javascript" src="js/jquery.cookie.min.js"></script>
<script type="text/javascript" src="js/jquery.collapsible.min.js"></script>
<script type="text/javascript" src="js/highlight.pack.js"></script>
<script name="jquery/bootstrap-datepicker.js" library="primefaces"></script>
<script src="js/warning.js" type=""></script>
<link rel="stylesheet" href="css/mytablestyle.css" />*/
<!-- <link rel="stylesheet" href="css/styles_ti_plus_2.css" /> -->
<h:outputStylesheet value="css/jquery-ui-1.10.2.custom.min.css" />
<!-- <link rel="stylesheet" href="css/jquery-ui-1.10.2.custom.min.css" /> -->
<!-- <h:outputScript name="css/jquery-ui-1.10.2.custom.min.css" /> -->
<!-- <script type="text/javascript" src="js/jquery-ui.js"></script> -->
<!-- <script type="text/javascript" src="js/jquery-1.10.2.js"></script> -->
<!-- <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css" /> -->
<!-- <script src="//code.jquery.com/jquery-1.10.2.js"></script> -->
<!-- <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script> -->
<!-- <h:outputScript name="js/jquery-ui-1.10.4.custom.min.js"/> -->
<div class="form-group">
<div style="height:500px">
<div>
<h3>Inline</h3>
<p:calendar value="#{calendarView.date1}" mode="inline"/>
<h3>Popup</h3>
<p:calendar value="#{calendarView.date2}" />
<h3>Popup Button</h3>
<p:calendar value="#{calendarView.date3}" showOn="button" />
<p:commandButton value="Submit" update="display" oncomplete="dialog.show()" />
<p:dialog header="Selected Dates" widgetVar="dialog"
showEffect="fold" hideEffect="fold"
height="150">
<h:panelGrid id="display" columns="2" cellpadding="5">
<h:outputText value="Inline Date:" />
<h:outputText value="#{calendarView.date1}">
<f:convertDateTime pattern="MM/dd/yyyy"/>
</h:outputText>
<h:outputText value="Popup Date:" />
<h:outputText value="#{calendarView.date2}">
<f:convertDateTime pattern="MM/dd/yyyy"/>
</h:outputText>
<h:outputText value="Popup Button Date: " />
<h:outputText value="#{calendarView.date3}">
<f:convertDateTime pattern="MM/dd/yyyy"/>
</h:outputText>
</h:panelGrid>
</p:dialog>
</div>
<h:form>
<h3>LEO DATE</h3>
<p:calendar value="#{calendarView.date3}" showOn="button" />
<p:dialog header="Selected Dates" widgetVar="dialog"
showEffect="fold" hideEffect="fold"
height="150">
<h:panelGrid id="display" columns="2" cellpadding="5">
<h:outputText value="Popup Button Date: " />
<h:outputText value="#{calendarView.date3}">
<f:convertDateTime pattern="MM/dd/yyyy"/>
</h:outputText>
</h:panelGrid>
</p:dialog>
</h:form>
</div>
</div>
Java代码
package com.misys.tiplus2.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
import org.primefaces.context.RequestContext;
import org.primefaces.event.SelectEvent;
@ManagedBean(name = "calendarView", eager = true)
public class CalendarView {
private Date date1;
private Date date2;
private Date date3;
public Date getDate1() {
return date1;
}
public void setDate1(Date date1) {
this.date1 = date1;
}
public Date getDate2() {
return date2;
}
public void setDate2(Date date2) {
this.date2 = date2;
}
public Date getDate3() {
return date3;
}
public void setDate3(Date date3) {
this.date3 = date3;
}
public void onDateSelect(SelectEvent event) {
FacesContext facesContext = FacesContext.getCurrentInstance();
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Date Selected", format.format(event.getObject())));
}
public void click() {
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.update("form:display");
requestContext.execute("PF('dlg').show()");
}
}
最佳答案
PrimeFaces 构建于 jQuery 之上
因此,如果您确实必须包含 jQuery API,那么请使用 PrimeFaces 附带的 API 以避免兼容性问题。这意味着您应该使用
<h:outputScript library="primefaces" name="jquery/jquery.js" />
而不是 <script src="js/jquery-1.9.1.js" type=""></script>
正如 Kukeltje 在评论中已经提到的,你确实必须清理你的 css 和 js 导入。另一个例子是您对日期选择器 API 的使用。您将其包含三次甚至更多:
<script src="src/main/webapp/js/bootstrap-datepicker.js" type="text/javascript"></script>
<script src="js/bootstrap-datepicker.js" type="text/javascript"> </script>
<script name="jquery/bootstrap-datepicker.js" library="primefaces"></script>
但是,在发布的 JSF View 中,甚至不需要包含任何这些 JS 文件,因为 PrimeFaces 会自动为您完成工作并生成 HTML(包括必要的 JS)。
此外,您还必须检查您的 xhtml。您根本没有关闭 h:head-tag,因此这甚至不应该呈现有效的 HTML 输出。
最后但并非最不重要的一点:请从开发人员的 Angular 描述您的问题(如果在这些更改之后仍然存在)。像 is not working kidly
这样的语句没有以正确的方式描述问题。
关于javascript - 日期选择器无法处理我的 jsf 和 xhtml 文件,任何人都可以指导我吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28213293/
有谁知道 xhtml 中选项卡的字符实体是什么? (嗯,如果有的话)... 最佳答案 (X)HTML 对制表符没有特殊支持:它们只是另一个空白字符,无论您是否对它们进行转义。 关于xhtml - XH
我了解根据 HTML 规范,向元素添加自定义属性是无效的。这对 XHTML 也无效吗? 我认为 XHTML 是 XML 家族的一部分,因此是可扩展的。作为可扩展性,使用自定义属性不是可以吗? 戴夫 最
有没有关于如何正确处理 XHTML (1.0 Transitional) 中的空格的信息?似乎 XHTML 不使用标准的 XML 空白处理。 编辑:梅比我对我到底在寻找什么有点不准确。我对元素如何呈现
据我了解,XHTML (1.0, 1.1) 和 XHTML 5 都不需要 DTD。如果这是真的,浏览器将如何区分两者? 我只能假设当浏览器供应商支持 (X)HTML 5 时,所有 XHTML 都将按照
我得到了一个带有 session 范围 bean 的 xhtml 页面。现在我想在另一个 html 页面中两次使用此页面,一次在屏幕左侧,一次在屏幕右侧。如果我包含它,它指的是同一个 bean,我怎样
就SEO而言,从客户端角度来看,我应该使用XHTML 1.0 Transitional还是XHTML 1.0 Strict? 为什么有些人仍然使用Transitional? 如果我们使用“严格过渡”,
我以前只用 p和 span元素...但我一直在插入使用正确的元素,这是我之前没有真正考虑过关于推荐的事情。 这是我想到的... I love your products! Jim Testimo
所有现代浏览器都理解 HTML,所以除了在键盘最右侧编写更多字符之外,兼容 XHTML 的意义何在。 最佳答案 没有一点我能想到的。 W3C 已经取消了 XHTML 2.0,尽管应该有一个 XHTML
我制作了一个 Windows 图标 (*.ico) 并将其命名为 favicon,它是 16 x 16 和 16 种颜色...我已将其包含在链接标签中 但是加载不正确 how do I add a f
我有一个问题: 在 Lift 网络框架 (Scala) 版本中。我得到: Message: java.util.NoSuchElementException scala.RandomAccessS
我已经编写了有效的 XHTML 1.0 Transitional 代码。我想添加社交分享按钮(twitter、facebook 和 google+),但所有这些按钮都使我的代码无效。有什么解决办法吗?
我想知道在 XHTML 中标记科学名称的最佳方法。 This answer说我应该使用 元素,我不太赞成,当然,除非它是正确的元素。 我可以使用 ,但鉴于 HTML 的第一个用途是标记科学文档,我想
角色属性是否有定义的值,如果有,您能说出它们是什么吗? 或者我可以为角色属性创建自己的值吗?它们区分大小写吗?它们必须是字母吗?可以有数字吗? 或者您可以同时拥有定义的值和用户创建的值。 最佳答案 快
分别阅读两者,看起来都一样,html+xml+javascript。 那和有什么区别?有没有? 最佳答案 XHTML是 w3c标准,一种也严格符合 XML 的 HTML 形式。 DHTML是一个很大程
在使用 XSL 将 XHTML 转换为 XHTML 时,我遇到了 namespace 问题。考虑作为示例输入: Test Remove this 然后
我有以下代码使用 Text.XHtml.Strict 库在 Haskell 中生成一个包含一系列带有 id 和类的 div 的空白 html 页面: module Main where import
我对 IE 的 XHTML 兼容性进行了激烈的辩论。唯一的问题是,我不确定这家伙是不是在挑衅。 从本质上讲,他声称 IE 完全不兼容 XHTML,并且无论使用何种浏览器,具有定义的 XHTML 文档类
我已经为此奋斗了一段时间,但我什至无法弄清楚为什么它不起作用。以这个简单的 XHTML 测试源为例: foobar
虽然不推荐使用 target="_blank",但为什么 W3C 验证器没有给出关于此的错误?您可以在 validator 中粘贴并检查此代码: Untitled Document Li
是否有可能使 anchor 链接内部没有具有背景图像和固定尺寸的文本,并且仍然适合SEO? CSS示例: a{display:block;width:50px;height:20px;backgrou
我是一名优秀的程序员,十分优秀!