标签: facelets

获取组件的坐标

在onclick事件之后如何获得JSF组件的坐标?我需要在点击的图标下方放置一个叠加层.

是否有任何这样的内置设施由JSF提供,而不是手动编写javascript函数?

jsf facelets primefaces

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

如何在JSP中使用Facelets的ui:repeat标签?

我在JSP 2.1上使用JSF 2.0.是否有可能<ui:repeat>在JSP文件中使用Facelets的标记?

我在JSP中导入了Facelets标记库

<%@ taglib uri="http://java.sun.com/jsf/facelets" prefix="ui"%>
Run Code Online (Sandbox Code Playgroud)

但是它并没有识别出来的taglib ui.taglib.xml,jsf-impl.jar并且在渲染时间方面给出了错误

org.apache.jasper.JasperException:绝对的uri:http://java.sun.com/jsf/facelets无法在web.xml或使用此应用程序部署的jar文件中解析

但是这个<ui:repeat>标签在我的Facelets文件中运行良好.

jsp facelets jsf-2

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

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万
查看次数

<! - [if IE]>条件注释在Facelets中呈现HTML转义

我正在尝试使用IE条件注释来声明CSS资源:

<h:outputStylesheet name="common.css" library="css" />
<!--[if IE]>
    <link rel="stylesheet" type="text/css" href="#{resource['css:ie.css']}" />   
<![endif]-->    
Run Code Online (Sandbox Code Playgroud)

但是,这似乎不起作用.我在生成的HTML输出中看到了这个:

<link type="text/css" rel="stylesheet" href="/context/faces/javax.faces.resource/common.css?ln=css" />        
<!--[if IE]&gt;
    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/context/faces/javax.faces.resource/ie.css?ln=css&quot;/&gt;
&lt;![endif]-->
Run Code Online (Sandbox Code Playgroud)

没有条件注释,它工作正常.我没有使用context参数javax.faces.FACELETS_SKIP_COMMENTS.这是怎么造成的,我该如何解决?

css jsf internet-explorer facelets conditional-comments

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

JSF Composite组件迭代并显示对象列表

在JSP和JSTL中,我会正常地做这样的事情:

<c:forEach items="${userList}" var = "user">
    <div id = "user-block">
        <h1>${user.name}</h1>
        <div id = "user-description">
            <p>${user.description}</p>
        </div>
        <ul>
            <li> Age: ${user.age} </li>
            <li> City: ${user.city} </li>
            <li> Country: ${user.country} </li>
        </ul>
    </div>
</c:forEach>
Run Code Online (Sandbox Code Playgroud)

我试图使用Facelet复合组件获得相同的结果:

<cc:interface>
    <cc:attribute name="value" type="java.util.List" required="true" shortDescription="The list of objects that should be displayed"/>
</cc:interface>

<cc:implementation>
    <div class = "event-block">

    </div>
</cc:implementation>
Run Code Online (Sandbox Code Playgroud)

问题是我不知道如何迭代#{cc.attrs.value}中的对象.

LE: 我想知道是否有办法在不使用JSP或JSTL的情况下解决这个问题

jsf facelets composite-component jsf-2

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

将Facelets编译为Java代码

我看到Jetty和Jasper有JSP编译器支持JSP中的JSF.但是,我也有兴趣编译Facelets.是否有可用的工具将其编译为Java代码或字节码?

jsf compilation facelets

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

将EL方法表达式作为自定义Facelets标记文件的属性传递

我创建了一个自定义的JSF标记:

<ui:composition>
    <h:panelGroup>
        <rich:dataScroller id="#{id}" for="#{table}" execute="#{table}"
            page="#{scrollerPage}" render="#{table}-sc1" maxPages="5"
            fastControls="hide" oncomplete="#{onCompl}" scrollListener="#{scrollListenerBean[scrollListenerMethod]}" />
        <h:inputText value="#{scrollerPage}" id="#{table}-sc1" size="2">
            <f:convertNumber integerOnly="true" />
        </h:inputText>
        <h:outputText styleClass="outputText"
            value=" of #{scrollPagesCount}  " />
        <h:commandButton value="GO! " />
    </h:panelGroup>
</ui:composition>
Run Code Online (Sandbox Code Playgroud)

为了传递监听器方法,我使用了一个相当古老的博客中建议的解决方案:

<my:dataScroller id="idDS1" table="table1"
                    scrollerPage="#{bean.navigationHelper.scrollerPage}"
                    scrollPagesCount="#{bean.navigationHelper.scrollPagesCount}"
                    onCompl="initForm();" 
                    scrollListenerBean="#{bean}"
                    scrollListenerMethod="aMethod" />
Run Code Online (Sandbox Code Playgroud)

我的问题是:这是最好的方法吗?如何使方法可选?

非常感谢任何帮助!再见!

jsf facelets tagfile jsf-2 methodexpression

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

为什么我得到h:outputLabel作为未知标签?

我正在尝试学习JSF,因为我在实习期间有一个项目,而且我真的很挣扎.

任何人都可以解释为什么在这段代码中我收到h:outputLabel的"未知标签"警告?

谢谢!

<?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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>

    <h:outputLabel value ="Welcome #{loginbean.name}"></h:outputLabel>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

jsf facelets

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

未知标签.xhtml jsf <f:selectItems />

这是Facelet:

<!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:h="http://java.sun.com/jsf/html">

 <h:head>
 <title>Title</title>
 </h:head>

 <h:body>
 <h:form>
 <h:commandButton value ="Converter" action ="#{conversorMonetarioBean.converte}"/>
 <h:inputText value ="#{conversorMonetarioBean.valor}"/>

 <h:outputLabel value ="de" for ="de"/>

 <h:selectOneMenu value ="#{conversorMonetarioBean.de}" id="de">
 <f:selectItems 
    value ="#{conversorMonetarioBean.taxas.keySet()}"
    var ="moeda"
    itemValue ="#{moeda}"
    itemLabel ="#{moeda}" />
 </h:selectOneMenu>

 <h:outputLabel value ="para" for ="para"/>

 <h:selectOneMenu value ="#{conversorMonetarioBean.para}" id="para">
 <f:selectItems
     value ="#{conversorMonetarioBean.taxas.keySet()}"
     var ="moeda"
     itemValue ="#{moeda}"
     itemLabel ="#{moeda}"  /> 
 </h:selectOneMenu>
 </h:form>



<h:outputFormat value ="{0} em {1} equivale a {2} em {3}" rendered ="#{conversorMonetarioBean.resultado != …
Run Code Online (Sandbox Code Playgroud)

facelets jsf-2

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

MyFaces hellow world application give NullPointerException error

I am a beginner with Java (as in 2 weeks of reading), and I would like to learn more by using a project created with Eclipse IDE. What I am using: - Java JDK 1.7 - Eclipse IDE Juno - Maven latest version - JBoss (7.1.1, 6.2 EAP, WidlFly) - all have the same behaviour - A maven project created with Maven archetype: myfaces-archetype-helloworld-facelets.

When trying to run, I receive a java.lang.NullPointerException in page. The log from JBoss is showing: …

java jsf facelets

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