我有这个f:viewParam,我尝试绑定验证,并转换userId成Player和我得到了一个意想不到的结果.
<f:metadata>
    <f:viewParam name="userId" value="#{myBean.selectedPlayer}" converter="pConverter"
         converterMessage="Bad Request. Unknown User" required="true"
         requiredMessage="Bad Request. Please use a link from within the system" />
</f:metadata>
<h:body>
    <p:messages id="msgs"/>        
    <h:form>
        <ul>
            <li><a href="index2.xhtml?userId=1">Harry</a></li>
            <li><a href="index2.xhtml?userId=2">Tom</a></li>
            <li><a href="index2.xhtml?userId=3">Peter</a></li>
        </ul>            
    </h:form>
    <h:form>
        <h:panelGrid columns="2" rendered="#{not empty myBean.selectedPlayer}">
            <h:outputText value="Id: #{myBean.selectedPlayer.id}"/>
            <h:outputText value="Name: #{myBean.selectedPlayer.name}"/>
        </h:panelGrid>
    </h:form>
    <h:form id="testForm">
        <h:inputText value="#{myBean.text}"/>
        <p:commandButton value="Switch" update=":msgs testForm"/>
        <h:outputText value="#{myBean.text}" rendered="#{not empty myBean.text}"/>
    </h:form>    
</h:body>
我的转换器看起来像这样
@FacesConverter(value="pConverter")
public class PConverter implements Converter …我正在使用Primefaces 3.5 2012年12月5日SNAPSHOT,Mojarra 2.1.14和Tomcat 7.0.33.
对于POJO对象的单元格内编辑模式(非行内),使用在ah:selectOneMenu中表示的模型/实体类,使用'click'作为celleditevent值,每当您单击一个对象然后单击通过单击其他对象,前一个对象显示其值而不是其标签.这只是"装饰性",当您重新加载页面时,它将显示标签值.
<p:dataTable id="insurancepolicyTable" var="insurancepolicy" widgetVar="insurancepolicyList" value="#{insurancepolicybean.objectList}" paginator="true" rows="15" paginatorPosition="bottom" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" currentPageReportTemplate="#{text['table.insurancepolicy.filter.count']}" rowsPerPageTemplate="15,25,50,100" emptyMessage="#{text['table.insurancepolicy.filter.notfound']}" filteredValue="#{insurancepolicybean.filteredObject}" editable="true" editMode="cell" cellEditEvent="click" draggableColumns="true" rowKey="#{insurancepolicy.id}" > 
               <p:column id="branchColumn" headerText="#{text['label.branch']}" sortBy="#{insurancepolicy.branch.name}" filterBy="#{insurancepolicy.branch.name}" filterMatchMode="contains">  
                <p:cellEditor>  
                    <f:facet name="output">  
                        <h:outputText value="#{insurancepolicy.branch.name}" />  
                    </f:facet> 
                    <f:facet name="input">  
                        <div  class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all">
                            <p:selectOneMenu id="branchselectinsurancepolicylist" value="#{insurancepolicy.branch}" styleClass="customSelect" converter="omnifaces.SelectItemsIndexConverter">                      
                                <f:selectItems value="#{insurancepolicybean.branchList}" var="branch" itemLabel="#{branch.name}" itemValue="#{branch}" />                    
                            </p:selectOneMenu>    
                        </div>
                    </f:facet> 
                </p:cellEditor>    
            </p:column>   
            <p:ajax event="cellEdit" listener="#{insurancepolicybean.onEdit}" update="@form" />
            <pe:resetInput event="cellEdit" for="@form" />
        </p:dataTable>  
启动Wildfly时,我收到以下警告:
WELD-000411:Observer方法[BackedAnnotatedMethod] public org.omnifaces.VetoAnnotatedTypeExtension.processAnnotatedType(@Observes ProcessAnnotatedType)接收所有带注释类型的事件.考虑使用@WithAnnotations限制事件或使用带边界的泛型类型.
知道可能导致这种情况的原因吗?这是启动日志:
F:\wildfly-8.1.0.CR2\bin\standalone.bat
[2014-05-30 08:31:55,733] Artifact Enterp:war exploded: Server is not connected. Deploy is not available.
Detected server admin port: 9990
Detected server http port: 8080
Calling "F:\wildfly-8.1.0.CR2\bin\standalone.conf.bat"
"JAVA_OPTS already set in environment; overriding default settings with values: -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:50542,suspend=y,server=n "
Setting JAVA property to "F:\Java\jdk1.8.0_05\bin\java"
===============================================================================
  JBoss Bootstrap Environment
  JBOSS_HOME: "F:\wildfly-8.1.0.CR2"
  JAVA: "F:\Java\jdk1.8.0_05\bin\java"
  JAVA_OPTS: "-Dprogram.name=standalone.bat -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:50542,suspend=y,server=n "
===============================================================================
Connected to the target VM, address: '127.0.0.1:50542', transport: 'socket'
20:31:56,715 INFO  [org.jboss.modules] (main) JBoss Modules version …我正在尝试显示存储在数据库中的内容.我有一个<o:graphicImage value="#{image.getById(1)}" />.
注意:ID(1)仅用于测试.
我的财产看起来像:
@Lob
private byte[] image;
我的dao /服务是这样的:
@Name
@ApplicationScoped
public class Images {
    @Inject
    private UserDAO userDAO;
    public byte[] getById(int id) {
        return userDAO.getUserByID(id).getImage();
    }
针对具体问题:
我刚刚实现了这一点,图像显示正确.我手动将图像设置到NULL数据库中.
我的假设:没有找到图像,也没有显示图像(或者没有找到典型的"图像"图像).
但是:显示旧图像.即使重新启动服务器并清理干净.没有改变.我试图将其他图像上传到数据库 - 结果相同.
这里有什么问题?我的错在哪里?我怎样才能解决这个问题?
我对OmniFaces的Viewscoped有点小问题.即使我的Managedbean实现Serializable,我收到以下错误:
具有钝化能力的bean必须满足具有钝化能力的依赖性.
通过一些研究,我找到了一些关于这个问题的答案但没有成功.我解决了我的问题,序列化了我正在用CDI注入的其他类.
我的其他类是否真的有必要在我的Managedbean中实现Serializable注入?
环境 - WebSphere Application Server 8.5.5.2 - Apache MyFaces 2.0.2 - OmniFaces 1.7 - PrimeFaces 5.0
我的课:
public class AgrupamentoAcoRN{
@Inject
public TbSiglaAcoAgrupadaDAO dao;
public void insereDados(TbSiglaAcoAgrupada tbSiglaAcoAgrupada) throws BancoDeDadosException{
    dao.insereRegistro(tbSiglaAcoAgrupada);
}
}
我的豆子:
@Named("agrupamentoAcoMb")
@ViewScoped
public class AgrupamentoAcoMB implements Serializable{
/**
 * 
 */
private static final long serialVersionUID = 1L;
@Inject
private AgrupamentoAcoRN rn;
}
我的项目昨天工作正常.我唯一做的就是将结构从单个战争改为多个模块.如果我理解正确的堆栈跟踪,焊接和omnifaces websocket lib之间存在模糊性.但是,似乎没有对stacktrace上的任何方法进行任何调用.也许这是omnifaces的问题?我甚至不使用omnifaces websockets,我使用javax.websocket.不过我过去在这个项目中尝试过,我搜索了"org.omnifaces.cdi"并从子包中注释掉了一些东西,@Param但问题仍然存在.另外我不明白为什么模糊性似乎来自两个完全相同的类:
- 具有限定符[@Any @Default]的Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager],
- 具有限定符的托管Bean [class org.omnifaces.cdi.push.SocketSessionManager] [@Any @Default]
[2016-06-25 03:13:59,430] Artifact core:war: java.lang.Exception: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"core-0.0.1-SNAPSHOT.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"core-0.0.1-SNAPSHOT.war\".WeldStartService: Failed to start service
    Caused by: org.jboss.weld.exceptions.DeploymentException: Exception List with 4 exceptions:
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type SocketSessionManager with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private org.omnifaces.cdi.push.SocketPushContextProducer.socketSessions
  at org.omnifaces.cdi.push.SocketPushContextProducer.socketSessions(SocketPushContextProducer.java:0)
  Possible dependencies: 
  - Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [@Any @Default],
  - Managed Bean [class …我一直试图在Wildfly 10上使用jsf 2.3,primefaces 6和omnifaces 2.6.1来运行应用程序.
我已经拆分了jsf 2.3(api和impl)并完成了WildFly的设置.
应用程序启动顺利,没有omnifaces 2.6.1.但是当我将omnifaces jar添加到应用程序类路径(/ lib)时,这个启动失败,给出了下一个异常:
13:21:52,024 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 78) Critical error during deployment: : com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:457)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:237)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:200)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:171)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:234)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
    Caused by: java.lang.UnsupportedOperationException
at javax.faces.application.Application.getSearchExpressionHandler(Application.java:2001)
at javax.faces.application.ApplicationWrapper.getSearchExpressionHandler(ApplicationWrapper.java:815)
at …我安装了 OmniFaces 1.6,并创建了带注释的类 @FacesConverter(forClass=MyClass.class)
在 GlassFish 的项目部署期间,我有几个磨损:
INFO: Initialisation de Mojarra 2.2.2 ( 20130809-1625 https://svn.java.net/svn/mojarra~svn/tags/2.2.2@12376) pour le contexte «/ErpCCFWEB»
WARNING: @FacesConverter is using both value and forClass, only value will be applied.
WARNING: @FacesConverter is using both value and forClass, only value will be applied.
WARNING: @FacesConverter is using both value and forClass, only value will be applied.
WARNING: @FacesConverter is using both value and forClass, only value will be applied.
WARNING: @FacesConverter is using both value and forClass, only …这是我想要做的:
@ViewScopedJSF bean,我在其中使用 Jersey 调用 JAX-RS 服务。image/svg+xml。到目前为止,我的研究使我相信:
h:graphicImage (核心 JSF)不支持 SVGp:graphicImage (PrimeFaces) 不支持 SVGo:graphicImage (OmniFaces) 也不支持 SVG。有没有办法从支持 bean 将 SVG 图像传送到 facelets 页面?服务 SVG 图像的服务将在稍后扩展以支持交付(以及其他格式)PNG,但我希望直接使用 SVG。
当我提交和更新 =“@form”时,我收到以下警告。
14:03:23,139 WARNING [javax.enterprise.resource.webcontainer.jsf.application.view] (default task-27) Unable to save dynamic action with clientId 'j_id2' because the UIComponent cannot be found
14:03:23,139 WARNING [javax.enterprise.resource.webcontainer.jsf.application.view] (default task-27) Unable to save dynamic action with clientId 'j_id3' because the UIComponent cannot be found
但是从faces-config.xml 中删除“org.omnifaces.resourcehandler.CombinedResourceHandler”,警告不会得到。
发展环境是...
这是最小样本。(但我的生产代码更复杂,收到了很多(20-1000)条警告。)
索引.xhtml
14:03:23,139 WARNING [javax.enterprise.resource.webcontainer.jsf.application.view] (default task-27) Unable to save dynamic action with clientId 'j_id2' because the UIComponent cannot be found
14:03:23,139 WARNING [javax.enterprise.resource.webcontainer.jsf.application.view] (default task-27) Unable to save dynamic action …jsf ×10
omnifaces ×10
cdi ×3
java ×2
jsf-2 ×2
primefaces ×2
wildfly ×2
converter ×1
dependencies ×1
graphicimage ×1
jsf-2.2 ×1
jsf-2.3 ×1
maven ×1
serializable ×1
validation ×1
view-scope ×1
viewparams ×1
warnings ×1