我在JSF2中的h:datatable中有一列单选按钮,但我找不到对它们进行分组的方法.意味着所有这些都可以在单选按钮的整点指向的同时被选择,以便在任何给定时间只能选择一个.我相信会有标准的做法.
我正在使用myfaces.如果确实需要,可以使用richfaces.
有人能帮忙吗.
我正在使用eclipse 3.6.2(Helios),Tomcat 7,MyFaces 1.2.9
当我将f:param用于h:commandLink时我没有问题但是当我把f:param放入h:commandButton时它不起作用.有什么问题 ?
这个样本工作正常:
<h:commandLink value="Click here" action="#{myBean.action}">
<f:param name="parameterName1" value="parameterValue1" />
<f:param name="parameterName2" value="parameterValue2" />
</h:commandLink>
Run Code Online (Sandbox Code Playgroud)
但事实并非如此
<h:commandButton value="Click here" action="#{myBean.action}">
<f:param name="parameterName1" value="parameterValue1" />
<f:param name="parameterName2" value="parameterValue2" />
</h:commandButton>
Run Code Online (Sandbox Code Playgroud) 我的表单有几个"提交"按钮,一些字段的验证取决于按下哪个.如何在我的自定义验证器中找到它?
我有两个Web应用程序(web-module1.war和web-module2.war),我想使用Web片段(web-core.jar)进行常见的servlet声明,如FacesServlet.
当我在web.xml中声明FacesServlet没问题,但是当我将此声明移动到web-fragment.xml时,我收到此错误:
java.lang.IllegalStateException: No Factories configured for this Application.
This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which …Run Code Online (Sandbox Code Playgroud) 我把它包含在我的index.jsp JSF文件中:
<%@ taglib prefix="ui" uri="http://java.sun.com/jsf/facelets"%>
Run Code Online (Sandbox Code Playgroud)
和Eclipse强调URL,悬停给出:
Cannot find the tag library descriptor for "http://java.sun.com/jsf/facelets"
Run Code Online (Sandbox Code Playgroud)
部署并尝试使用Tomcat插件启动Tomcat 6会导致:
|STDOUT| 2010-03-03 17:57:29,872 | INFO | [main]: Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
|STDOUT| 2010-03-03 17:57:29,904 | INFO | [main]: ServletContext 'C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\myapp\' initialized.
|STDOUT| 2010-03-03 17:57:29,904 | INFO | [main]: Checking for plugins:org.apache.myfaces.FACES_INIT_PLUGINS
03-Mar-2010 17:57:29 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
03-Mar-2010 17:57:29 org.apache.catalina.core.StandardContext start
SEVERE: Context [/myapp] startup failed due to previous errors
Run Code Online (Sandbox Code Playgroud)
...
03-Mar-2010 17:57:30 com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected …Run Code Online (Sandbox Code Playgroud) 我是JSF 2.0的新手.
我正在使用JSF 2.0的apache Myfaces实现.
另外,我想使用Prime面来获得更好的UI组件.
但我面临的问题是:
两者的标签Prime faces and Myfaces是相同的.
我该如何解析前缀.
例如: h: and f:
我刚刚开始研究java web-app的开发.我必须在其Web层中使用JSF框架.谷歌搜索我确实看到JSF的实现数量.Apache Myfaces,Jboss Primefaces等
请任何人指导我,现在最好从哪个实现调用 - a)支持/文档/教程b)稳定性c)相同的未来方面d)与应用服务器的兼容性
我强行使用一个非常旧版本的MyFaces 2.0.5我认为,动态包含EL导致这么多问题,所以我切换到静态包含ui:fragment
<ui:fragment rendered="#{filtersPopup.filterFileName == 'checkBoxFilters'}">
checkBoxFilters
<ui:include src="/analytics/checkBoxFilters.xhtml" rendered="#{filtersPopup.filter != null}"/>
</ui:fragment>
<ui:fragment rendered="#{filtersPopup.filterFileName == 'DateRelativeFilter'}">
DateRelativeFilter
<ui:include src="/analytics/DateRelativeFilter.xhtml" rendered="#{filtersPopup.filter != null}"/>
</ui:fragment>
<ui:fragment rendered="#{filtersPopup.filterFileName == 'listboxFilter'}">
listboxFilter
<ui:include src="/analytics/listboxFilter.xhtml" rendered="#{filtersPopup.filter != null}"/>
</ui:fragment>
Run Code Online (Sandbox Code Playgroud)
有了它,它仍然抱怨重复的id,因为我在这些源文件的夫妇上使用相同的id.所以它似乎rendered应该是false,它仍然使它成为组件树.但重复的ID很好.我可以轻松解决这个问题,所以现在当我提交表单时,我得到了这个例外
/analytics/checkBoxFilters.xhtml at line 24 and column 118 value="#{filtersPopup.filter.groups}": Property 'groups' not found on type ListBoxFilter
Run Code Online (Sandbox Code Playgroud)
所以从异常中可以看出,它ListBoxFilter是我想要的对象,所以只包含ListBoxFilter.xhtml,但正在访问checkBoxFilters.xhtml因此错误.知道如何解决这个问题吗?
我正在尝试将简单的 JSF2.2 原型从Mojarra 2.2.5(...工作正常...)迁移到MyFaces 2.2.3,但出现NullPointerException。我通常使用 Mojarra 做的是以编程方式
在容器中
包含(注入)JSF 页面。
示例包含页面(inclusion.xhtml)是:
<h:panelGroup id="container">
</h:panelGroup>
<h:form>
<h:commandButton value="Include page" action="#{inclusion.include('included.xhtml')}" />
</h:form>
Run Code Online (Sandbox Code Playgroud)
包含的页面(included.xhtml)包含类似以下内容:
<h:outputText value="INCLUDED TEXT ..." />
Run Code Online (Sandbox Code Playgroud)
这是托管 bean:
@ManagedBean(name="inclusion")
@RequestScoped
public final class Inclusion {
public void include(String contentUrl) throws IOException{
FacesContext fc = FacesContext.getCurrentInstance();
FaceletContext f2ctx = (FaceletContext) fc.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
UIComponent uic = fc.getViewRoot().findComponent("container");
if (uic != null && f2ctx != null) {
f2ctx.includeFacelet(uic, contentUrl);
}
} …Run Code Online (Sandbox Code Playgroud) 我可以在同一个项目中使用多个 JSF 实现吗?例如,我可以将 PrimeFaces 与 MyFaces 混合使用吗?这有什么影响?
我不能似乎能当我内触发事件column的dataTable.这是我简单的演示
<h:form id="form">
<!--This section of p:tree here seems to be the reason causing the event not fired when click the command button-->
<p:tree value="#{viewBean.root}" var="node" dynamic="true" cache="false"
selectionMode="checkbox" selection="#{treeBean.selectedNode}">
<p:ajax event="expand" update=":form:messages" listener="#{viewBean.onNodeExpand}" />
<p:ajax event="collapse" update=":form:messages" listener="#{viewBean.onNodeCollapse}" />
<p:ajax event="select" update=":form:messages" listener="#{viewBean.onNodeSelect}" />
<p:ajax event="unselect" update=":form:messages" listener="#{viewBean.onNodeUnselect}" />
<p:treeNode>
<h:outputText value="#{node}" />
</p:treeNode>
</p:tree>
<h:panelGroup id="mygroup">
<p:dataTable id="mytable" value="#{viewBean.foodList}" var="item">
<p:column>
#{item}
</p:column>
<p:column>
<p:commandButton value="delete"
action="#{viewBean.delete}"
update=":form:mygroup">
<f:setPropertyActionListener target="#{viewBean.selectedFood}"
value="#{item}"/>
</p:commandButton>
</p:column>
</p:dataTable> …Run Code Online (Sandbox Code Playgroud) 我一直致力于一个项目,并试图了解这些组件的工作原理.我对每个人扮演的角色感到困惑.我目前的任务是在Tomcat 5.5中使用一个利用JSF,MyFaces,Trinidad和Facelets的项目,并让它在Tomcat 6.0中运行.当我在新容器中运行它时,我的行为非常奇怪.所以我想弄清楚我是否需要更新这些库中的任何一个.但我似乎无法弄清楚这些是如何一起工作的.所以这里有一些问题:
鉴于此信息,Tomcat版本是否对这些框架有直接影响?
myfaces ×12
jsf ×7
jsf-2 ×6
primefaces ×5
facelets ×3
eclipse ×2
facesservlet ×1
jsf-1.2 ×1
jsf-2.2 ×1
mojarra ×1
tomcat ×1
tomcat7 ×1
trinidad ×1
web-fragment ×1