小编Fed*_*ico的帖子

如何为数据表列创建复合组件?

鉴于此数据表(自然工作):

<rich:dataTable var="var" value="#{values}">
<rich:column>
  <f:facet name="header">
   HEADER
  </f:facet>
  <h:outputText value="#{var}" />
</rich:column>
</rich:dataTable>
Run Code Online (Sandbox Code Playgroud)

如果我定义一个自定义组件(在语法和资源/组件下的正确位置也可以):

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

    <!-- INTERFACE -->
    <composite:interface>
        <composite:attribute name="val" />
    </composite:interface>

    <!-- IMPLEMENTATION -->
    <composite:implementation>
        <rich:column>
            <f:facet name="header">
       HEADER
       </f:facet>
       <h:outputText value="#{cc.attrs.val}" />
       </rich:column>
    </composite:implementation>
    </html>
Run Code Online (Sandbox Code Playgroud)

为什么以下不起作用?

<?xml version="1.0" encoding="UTF-8"?>
<ui:composition template="/WEB-INF/templates/default.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:my="http://java.sun.com/jsf/composite/components">
    <ui:define name="content">
        <rich:dataTable var="var" value="#{values}">
                 <my:mycolumn val="#{var}"/>
                </rich:dataTable>
    </ui:define>
</ui:composition>
Run Code Online (Sandbox Code Playgroud)

你知道我怎么能让它工作(我想定义自己的列并保存代码)?非常感谢!再见

datatable jsf richfaces composite-component

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

jaxb2 maven插件在第二次执行时不起作用

我有一个模块化项目,在每个模块中,我使用jaxb2-maven-plugin用xjc编译XSD文件.现在,假设模块按照A - > B的顺序编译.对于A一切正常(即我得到*XsdImpl.java),但对于BI,请获取以下内容:

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.2:xjc (model) on project B: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.2:xjc (model) on project B: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597) …
Run Code Online (Sandbox Code Playgroud)

jaxb xjc maven-3 maven

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

JSF 2相当于IBM的hx:scriptCollector pre-postRender

我正在将旧的JSF应用程序从WebSphere迁移到JBoss:旧版本使用IBM的JSF实现.我的问题涉及以下组件:

<hx:scriptCollector id="aScriptCollector"
        preRender="#{aBean.onPageLoadBegin}" postRender="#{aBean.onPageLoadEnd}">
Run Code Online (Sandbox Code Playgroud)

要在JSF 2中重现preRender行为,我使用表单的绑定(此处为s.).我的问题:

1)你知道在JSF 2中模拟postRender的技巧吗?

2)你认为我正在使用preRender"干净"的技巧吗?

非常感谢你的帮助!再见

websphere jsf jsf-2

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

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

Spring JMS Connections:性能考虑因素

我需要向/从存储在单个JMS服务器上的不同主题发送/接收消息.

我想JmsTemplate用于发送和MessageListenerContainer注册异步侦听器.

我的配置如下所示:

<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
        <props>
            <prop key="java.naming.factory.initial">xxx</prop>
            <prop key="java.naming.provider.url">yyy</prop>
        </props>
    </property>
</bean>
<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref ="jndiTemplate"/>
        <property name="jndiName" value="TopicConnectionFactory"/>
    </bean>

    <bean id="singleConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
        <constructor-arg ref="connectionFactory"/>
    </bean>

    <bean id="tosJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="singleConnectionFactory"/>
        <property name="destinationResolver" ref="destinationResolver"/>
        <property name="pubSubDomain" value="true"/>
    </bean>
Run Code Online (Sandbox Code Playgroud)

据我所知singleConnectionFactory,返回总是相同的连接实例,有助于减少每次jmsTemplate需要(例如)发送/接收消息时创建和关闭连接的开销(就像使用法线时一样ConnectionFactory).

我的第一个问题是:如果我创建了多个jmsTemplate(s),他们是否可以共享一个参考singleConnectionFactory?或者,他们要接受不同的情况下,每个(singleConnectionFactory1,singleConnectionFactory2,等)?

阅读API SingleConnectionFactory,我发现了这个:

请注意,Spring的消息侦听器容器支持Connection 在每个侦听器容器实例中使用共享.SingleConnectionFactory组合使用对于跨多个侦听器容器共享单个JMS连接非常有意义.

这听起来对我来说有点神秘.据我所知,每个只能注册一个Listener MessageListenerContainer,所以我不明白连接的共享程度.

假设我要注册N个监听器:我需要重复N次这样的事情:

<bean 
    class="org.springframework.jms.listener.SimpleMessageListenerContainer"> …
Run Code Online (Sandbox Code Playgroud)

performance spring jms spring-jms

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

在Jboss上使用带有JSF 2的ISO-8859-1编码

我有一个使用以下指令的JSP页面:

<%@page contentType="text/html; charset=iso-8859-1" pageEncoding="iso-8859-1"%>
Run Code Online (Sandbox Code Playgroud)

因此,页面中的表单使用ISO-8859-1编码发送,bean接收(在setXXX()方法中)根据此格式编码的字符串.

我想将JSP"转换"为JSF 2,它使用UTF-8作为默认值.如何强制JSF使用ISO-8859-1并因此模拟页面指令?

我在jboss 6上使用Mojarra + richfaces.

谢谢!

jsf jboss character-encoding jsf-2 mojarra

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