相关疑难解决方法(0)

XML或文本声明不在实体的开头

抱歉有点愚蠢.但我明白(我缺乏知识)如果你想在那个页面上使用RichFaces组件,就不可能转发到另一个页面.

这是我转发到具有RichFaces组件的页面时遇到的一些问题

  • 如果我转发到带有表单的页面,则会有数百个包含的JavaScrip被解释为格式错误的XML标记.
  • 如果我使用嵌套表,表将松散CSS文件,看起来像普通的JSF 2.0 dataTables.
  • 当转发到只有tabPanel的页面时,如演示TabPanel - Show Case一样,选项卡面板变得混乱并变得不可用(参见图像beelow).

我不需要转发到具有RichFaces组件的页面,但是拥有该选项会很好.可能我误解了如何使用RichFaces的关键.

仅为了您的信息,我在NetBeans 7.0.1中创建了一个全新的Web项目并制作了两个页面.通过a4j:commandLink我从第一页转发到第二页有一个选项卡面板.渲染变得混乱,面板变得无法使用.除了包含RichFaces所需的库和标签之外,新项目完全没有web.xml和rich-faces.xml中的setup参数.

当我转发到具有RichFaces组件的页面时,我错过了什么?

PS.如果有一个模式可以遵循,这将有助于如何使页面转发与RichFaces一起工作.

问候克里斯.

这是firebug报告的错误(在调用转发之后)

XML or text declaration not at start of entity
http://localhost:8080/humis/faces/app_user/projectHome.xhtml
Line 7
Run Code Online (Sandbox Code Playgroud)

Firebug报告页面的这些状态

  • 200好的
  • 304未修改

它是标题中的内容,包括20-30个脚本.不知道如何在这里包含长html列表.它自己接受的请求没问题,但RichFaces生成了一些我可以控制进行页面转发的东西.

masterLayout文件;

<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <h:outputStylesheet name="css/default.css"/>
    <h:outputStylesheet name="css/cssLayout.css"/>

    <title>
        <h:outputText value="Partner Tapestry - " /> <ui:insert name="title">Browser Title</ui:insert>
    </title>
</h:head>

<h:body>
    <div id="top" >
        <ui:insert name="top">Top Default</ui:insert>
    </div>

    <div id="messages">
        <rich:messages id="messagePanel" ajaxRendered="true"/>
    </div>

    <div id="content">
        <ui:insert name="content">Content Default</ui:insert>
    </div> …
Run Code Online (Sandbox Code Playgroud)

xml jsf facelets jsf-2

4
推荐指数
1
解决办法
8935
查看次数

java.lang.NullPointerException at javax.faces.webapp.UIComponentClassicTagBase.setJspId

I have read this tutorials it's an ebook and I'm stuck at deploying the JSP page to my tomcat server by the way it's a jsp page but it's using JSF tags I already put my javax.faces-2.1.13 jar at the lib, where is should really belong to..

Here is my JSP page title hello.jsp:

 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>

<html>
<head>
<title>JSF In Action</title>
</head>
<body>
<f:view>
    <h:form id="welcome-form"> …
Run Code Online (Sandbox Code Playgroud)

jsf jsp

4
推荐指数
1
解决办法
2万
查看次数

JSF模板:呈现的页面缺少DOCTYPE

TL; DR:我无法将DOCTYPE标头显示在我的JSF页面上.

我刚刚继承了一个JSF 1.2项目,它在IE下有一些显示问题.我是JSF的新手,但我认为问题源于渲染页面(来自"视图源")不包含正确的事实DOCTYPE.

页面由多个部分组成,使用多个层组合在一起<ui:composition>.典型页面如下所示:

<?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="http://www.w3.org/1999/xhtml"
                template="../layout/template.xhtml">

    <ui:define name="body">
      <!-- html content goes here... -->
    </ui:define>
</ui:composition>
Run Code Online (Sandbox Code Playgroud)

然后../layout/template.xhtml有:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                template="./headertemplate.xhtml">

    <ui:define name="menuSelection">
        <ui:insert name="menuSelection"/>
    </ui:define>
    <ui:define name="body">
        <ui:insert name="body"/>
    </ui:define>
    <ui:define name="footer">
        <div class="footer">
            <ui:include src="footer.xhtml"/>
        </div>
    </ui:define>
</ui:composition>
Run Code Online (Sandbox Code Playgroud)

最后,headertemplate.xhtml:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
            contentType="text/html">
     <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" …
Run Code Online (Sandbox Code Playgroud)

jsf facelets

3
推荐指数
1
解决办法
4989
查看次数

警告:此页面调用使用前缀[html tag]声明的XML名称空间,但该名称空间不存在taglibrary

我知道这个问题已被问过几次,但我似乎无法找到我的代码有什么问题,所以我再次要求它 - 抱歉:-).

我目前正在使用部署在Glassfish上的JavaEE6框架上的JSF2.1.对于抛出此错误的页面,我有一个baseTemplate,其中包含页眉和页脚.然后我有一个继承baseTemplate的页面,基本上它们是:BaseTemplate:

<?xml version='1.0' encoding='UTF-8' ?>
<!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">
<f:view>
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title></title>
        <link rel="shortcut icon" href="" />
        <h:outputStylesheet library="css" name="site.css" target="head"></h:outputStylesheet>
        <ui:insert name="head" />
    </h:head>
    <h:body>
        <div id="wrapper" class="rounded-box">content...
Run Code Online (Sandbox Code Playgroud)

<?xml version='1.0' encoding='UTF-8' ?>
<f:view xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">

    <div class="header">
Run Code Online (Sandbox Code Playgroud)

页脚只包含普通的html标签.

和实际的页面,这是一个登录.

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    template="/shared/page/_twoColumn.xhtml"> …
Run Code Online (Sandbox Code Playgroud)

html jsf jsf-2

3
推荐指数
1
解决办法
1万
查看次数

JSF 2:如何将包含要调用的参数的操作传递给Facelets子视图(使用ui:include和ui:param)?

这基本上是对这个答案的延伸.

我试图在方法/动作调用中获取参数(对于列表/数据表中的删除按钮).

客户:

<ui:include src="...">
  <ui:param name="acceptButtonBean" value="#{repoHome}" />
  <ui:param name="acceptButtonAction" value="removeIndividualDocument(#{doc.id})" />
</ui:include>
Run Code Online (Sandbox Code Playgroud)

子视图:

<h:commandButton value="Continue"
                 action="#{acceptButtonBean[acceptButtonAction]}" />
  ...
</h:commandButton>
Run Code Online (Sandbox Code Playgroud)

但是,JSF失败了,例外情况说:

...yadda, yadda
02:46:02,431 ERROR [stderr] (http--127.0.0.1-8080-5) Caused by: javax.el.MethodNotFoundException: /subviews/remove-doc-clink-popup.xhtml @37,98 action="#{acceptButtonBean[acceptButtonMethod]}": Method not found: com.company.project.beans.RepoHome@34b183e7.removeExternalDocument(89)()
02:46:02,431 ERROR [stderr] (http--127.0.0.1-8080-5)    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:109)
02:46:02,431 ERROR [stderr] (http--127.0.0.1-8080-5)    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
02:46:02,431 ERROR [stderr] (http--127.0.0.1-8080-5)    ... 31 more
Run Code Online (Sandbox Code Playgroud)

请注意

....RepoHome@34b183e7.removeExternalDocument(89)()
Run Code Online (Sandbox Code Playgroud)

它不能那样工作.JSF似乎附加括号无所谓.

它可以以不同的方式实现,但仍然采用上述技术吗?如果是这样,怎么样?

如果没有,为什么不工作?是否指定了?这是Mojarra 2.0.x的错误吗?如果有其他括号,我认为省略括号没有问题...

注意我不是在寻找替代解决方案,比如使用f:param,f:attribute或f:setPropertyActionListener.

提前致谢

facelets el jsf-2

2
推荐指数
1
解决办法
1万
查看次数

找不到ManagedBean属性

在我的webapp中,当我单击登录链接时,Tomcat Web服务器会抛出以下异常:

exception
javax.servlet.ServletException: /aluno_jsf.xhtml: Property 'logout' not found on type
br.com.aluno.controller.LoginMB

javax.faces.webapp.FacesServlet.service(FacesServlet.java:422)

root cause
javax.el.ELException: /aluno_jsf.xhtml: Property 'logout' not found on type
br.com.aluno.controller.LoginMB
[...]
Run Code Online (Sandbox Code Playgroud)

这是我的@ManagedBean:

package br.com.aluno.controller;

import java.io.Serializable;
import java.util.Collection;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;
import br.com.aluno.dao.DaoFactory;
import br.com.aluno.entity.Usuario;
import br.com.aluno.util.JsfUtil;

@ManagedBean
public class LoginMB implements Serializable {
private static final long serialVersionUID = 6667329439219329074L;

private Usuario usuario;

@PostConstruct
public void init() {
    usuario = new Usuario();
}

public void logar() {
    try {
        Collection<Usuario> …
Run Code Online (Sandbox Code Playgroud)

jsf el

2
推荐指数
1
解决办法
2万
查看次数

Facelet模板呈现两个HTML标记

我正在创建我的第一个facelets/JSF应用程序.在我的第一页中,我添加了一个facelet模板:

<?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:f="http://java.sun.com/jsf/core" 
xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> 
<f:view>
  <h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Insert title here</title>
  </h:head>
  <body>
    <ui:insert name='top'>
      <ui:include src="/templates/template_a.xhtml"></ui:include>
</ui:insert>
  </body>
</f:view>
</html>
Run Code Online (Sandbox Code Playgroud)

这是我的模板页面:

  <?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:f="http://java.sun.com/jsf/core" 
xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets">
  <h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Insert title here</title>
  </h:head>
  <body>
    <ui:composition template="/inwert_a.xhtml">
      <ui:define name="top">
      <h2>naglowek</h2>
    </ui:define>
  </ui:composition>
</body> 
</html>
Run Code Online (Sandbox Code Playgroud)

但是当我在网络浏览器中查看页面源代码时,我看到了:

<?xml version="1.0" encoding="ISO-8859-1" …
Run Code Online (Sandbox Code Playgroud)

java jsf facelets

2
推荐指数
1
解决办法
2172
查看次数

primefaces模板ajax状态

如何制作包含ajax状态以供全局使用的primefaces模板.

到目前为止,这就是我所做的.

template/default.xhtml(Facelets模板)

<?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">
<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:p="http://primefaces.org/ui">

<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="./../resources/css/default.css" rel="stylesheet" type="text/css" />
    <link href="./../resources/css/cssLayout.css" rel="stylesheet" type="text/css" />
    <title>Facelets Template</title>
</h:head>

<h:body>

    <div id="top">
        <ui:insert name="top">
            <!--modal ajax status here-->
            <p:ajaxStatus onstart="statusDialog.show();" oncomplete="statusDialog.hide();"/>  

            <p:dialog modal="true" widgetVar="statusDialog" header="Loading"   
                      draggable="false" closable="false">  
                <p:graphicImage value="../resources/images/ajax-loader-square.gif" />  
            </p:dialog>
            <!--modal ajax status end-->
        </ui:insert>
    </div>

    <div id="content" class="center_content">
        <ui:insert name="content">Content</ui:insert>
    </div>

    <div id="bottom">
        <ui:insert name="bottom">Bottom</ui:insert>
    </div>

</h:body>
Run Code Online (Sandbox Code Playgroud)

login.xhtml(Facelets模板客户端) …

ajax jsf templates facelets primefaces

2
推荐指数
1
解决办法
1万
查看次数

如何在 af:facet 上显示另一个 f:facet 的内容

使用 Primefaces 创建数据表时,我想在页眉和页脚方面创建一个按钮,但不重复代码。

考虑在<p:dataTable/>元素上具有以下标头方面:

<f:facet name="header">
    <p:commandButton value="Preview" icon="pi pi-search" update="@form:dPreview"
                     oncomplete="PF('wvdPreview').show()"
    />
</f:facet>
Run Code Online (Sandbox Code Playgroud)

如何在另一个方面(比如说name="footer")添加相同的代码而不重复代码?

我在互联网上搜索了一些选项,但只找到了复制标头代码或创建全新组件的选项,并且我不希望应用任何这些方法,除非没有其他方法。

jsf facet primefaces

1
推荐指数
1
解决办法
114
查看次数

标签 统计

jsf ×8

facelets ×5

jsf-2 ×3

el ×2

primefaces ×2

ajax ×1

facet ×1

html ×1

java ×1

jsp ×1

templates ×1

xml ×1