我对此有点困惑:
还有一件事,我有一些想法,我们可以设计GUI工具,创建实体,定义关系,定义配置,如id生成序列,多个唯一列,复合键等,并为您生成JPA实体.
这种工具是否存在?也许作为一个eclipse插件或其他东西?
如果我能以某种方式将这两个框架结合在一起,那将会非常酷.
单击Primefaces Datatable上的next或prev按钮将触发查询,使用JPA限制查询结果.
也许有一些机制,primefaces组件也可以从另一个JPA选择计数查询中获取总页数?
有没有关于如何将这些付诸实践的例子?
请分享您的经验.
谢谢 !
我希望能够处理这种情况,我希望它在延迟后重试,但似乎我在ServiceUnavailableRetryStrategy中设置的延迟没有发生:
19:42:29.046 [scheduler-15] INFO oahttp.impl.execchain.RetryExec - 处理{}的请求时遇到的I/O异常(org.apache.http.NoHttpResponseException) - > http://testing.com:80:目标服务器无法响应19:42:29.049 [scheduler-15] INFO oahttp.impl.execchain.RetryExec - 重试请求{} - > http://testing.com:80
我同时设置了ServiceUnavailableRetryStrategy和HttpRequestRetryHandler.从两者看来,似乎只有ServiceUnavailableRetryStrategy有一个延迟选项,我没有看到httpRequestRetryHandler的任何延迟选项.
那么在上面的NoHttpResponseException的情况下,实际使用了哪一个?这两者有什么区别?
我目前正在从核心jsf 2.0 book + glassfish + cdi学习jsf 2.0.
我想问一个关于使用bean-validation-framework处理未在jsf页面或托管/命名bean中定义的验证的问题.我脑子里有这些层次:
我想象层1.5(jsf bean)初始化和调用第2层(业务逻辑对象),在调用业务方法时提供参数,获取结果,将结果填充到jsf bean属性中,以便ui可以正确呈现.
令人好奇的是,第2层(业务逻辑对象)可以对提供的参数进行验证,或者验证数据等,并且可能抛出异常或错误对象.
我想我可以处理异常并获取层1.5(jsf托管bean)中的错误对象,但是我应该如何在呈现的页面中显示错误?我似乎无法从我正在阅读的书中找到它,但我希望有一种方法来创建一个全局错误消息,并以某种方式可以将它注入某个地方,以便它由标记呈现?
谢谢 !
我已经读过核心JSF组件支持f:param和f:属性标记,以便将一些值传递给服务器端的封闭UI组件.
我需要能够为primefaces的自动完成组件执行此操作,以便自动完成方法能够使用f:param或f:属性提供的参数.我试图找到实现这一目标的方法,并发现完整的方法参数是固定的,不能采用更多的参数,因此我想使用f:param或f:attribute.
我使用2.2.x版本,并根据我的实验,我似乎无法得到f:param或f:属性工作
<p:autocomplete ...>
<f:param name="myParam" value="xxxx" />
</p:autocomplete>
Run Code Online (Sandbox Code Playgroud)
primefaces是否支持自动完成组件上的此功能?无论如何,我可以找出支持参数的标签和那些不支持的标签?
谢谢 !
我目前正在创建一个JSF复合组件,其方法签名可以接受参数.
这是摘录:
<composite:interface>
....
<composite:attribute name="activateHeroMethod" method-signature="java.util.List action(id.co.sofcograha.core.Dto, id.co.sofcograha.core.Dto)" />
</composite:interface>
<composite:implementation>
....
<p:commandLink value="#{hero.map['heroName']}"
process="@this"
update="#{cc.attrs.update}"
oncomplete="infoRaceDialog.hide()"
image="ui-icon ui-icon-search">
<f:setPropertyActionListener value="#{hero}"
target="#{cc.attrs.activateHeroMethod(infoRaceBean.race, hero)}" />
</p:commandLink>
....
</composite:implementation>
Run Code Online (Sandbox Code Playgroud)
target ="#{cc.attrs.activateHeroMethod(infoRaceBean.race,hero)}"因以下错误消息而失败:
javax.faces.view.facelets.TagAttributeException: /resources/sofco/infoRace.xhtml @57,76 target="#{cc.attrs.activateHeroMethod(infoRaceBean.race, hero)}" /resources/sofco/infoRace.xhtml @57,76 target="#{cc.attrs.activateHeroMethod(infoRaceBean.race, hero)}" Illegal attempt to pass arguments to a composite component lookup expression (i.e. cc.attrs.[identifier]).
at com.sun.faces.facelets.tag.TagAttributeImpl.getValueExpression(TagAttributeImpl.java:401)
at com.sun.faces.facelets.tag.TagAttributeImpl.getValueExpression(TagAttributeImpl.java:351)
at com.sun.faces.facelets.tag.jsf.core.SetPropertyActionListenerHandler.applyAttachedObject(SetPropertyActionListenerHandler.java:128)
at com.sun.faces.facelets.tag.jsf.core.SetPropertyActionListenerHandler.apply(SetPropertyActionListenerHandler.java:101)
Run Code Online (Sandbox Code Playgroud)
是否可以从复合组件的属性中调用参数化方法?我认为我可以处理多个作为在一个方法中使用多个参数的解决方法,但我不喜欢这种方法,因为它会随着参数的增加而变大.
我可以将每个参数包装成1个包装器对象,但我仍然很好奇是否有办法解决调用多个参数的方法的问题.
请分享你的想法!
谢谢.
访问
http://localhost:8080/basicSetup/faces/index.xhtml
Run Code Online (Sandbox Code Playgroud)
工作,输出:
你好,世界 !Albert Kam
但访问
http://localhost:8080/basicSetup
Run Code Online (Sandbox Code Playgroud)
节目
你好,世界 !#{} myBean.value
意味着欢迎文件不会呈现为JSF文件
我希望http://localhost:8080/basicSetup获得与访问相同的效果http://localhost:8080/basicSetup/faces/index.xhtml.
请分享你的想法
jetty-maven-plugin:8.0.3.v20111011:run + jdk 7 + eclipse indigo
这是我的web.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Basic Setup Web Application</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<listener>
<listener-class>
com.sun.faces.config.ConfigureListener
</listener-class>
</listener>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
</web-app>
Run Code Online (Sandbox Code Playgroud)
这是jetty maven插件输出:
[INFO] >>> jetty-maven-plugin:8.0.3.v20111011:run (default-cli) @ BasicSetup >>>
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ …Run Code Online (Sandbox Code Playgroud) 可能重复:
create-session无状态使用
我刚刚开始在版本3.1上尝试Spring Security,我想知道如何使用无状态webapp实现身份验证.
想到了http-basic和digest,我已经尝试过了,但我不喜欢在不关闭浏览器的情况下无法注册表单身份验证.
我目前有一个工作状态无状态的webapp,使用spring安全性进行基于表单的身份验证(通过在会话中存储auth东西使其成为状态?),我想知道我可以研究什么策略来使Spring安全工作不使用http会话?
我意识到有一个<http create-session="stateless" ..>,但必须有一些东西需要做更多的事情因为应用程序在我尝试之后停止正常工作,通过在访问受保护资源时保持身份验证.
这是我的配置:
<http use-expressions="true" create-session="stateless">
<form-login login-page="/login"
login-processing-url="/static/j_spring_security_check"
authentication-failure-url="/login?login_error=t" />
<logout logout-url="/static/j_spring_security_logout"/>
<intercept-url pattern="/person/test/**"
access="isAuthenticated() and principal.username=='albertkam'"
/>
<intercept-url pattern="/person/**" access="hasRole('ROLE_NORMAL')"/>
<remember-me
key="spitterKey"
token-validity-seconds="2419200"/>
</http>
Run Code Online (Sandbox Code Playgroud)
用 create-session="stateless":
没有 create-session="stateless",默认为ifRequired(有状态):
我想在我的@BeforeTest方法中将一些Web范围注册到spring上下文中.但事实证明,春天的背景仍然存在null.
如果我改变,测试运行正常@BeforeMethod.我想知道如何访问上下文@BeforeTest,因为我不希望为每个测试方法重复范围注册代码.
以下是我的代码片段.
public class MyTest extends MyBaseTest {
@Test public void someTest() { /*...*/ }
}
@ContextConfiguration(locations="/my-context.xml")
public class MyBaseTest extends AbstractTestNGSpringContextTests {
@BeforeTest public void registerWebScopes() {
ConfigurableBeanFactory factory = (ConfigurableBeanFactory)
this.applicationContext.getAutowireCapableBeanFactory();
factory.registerScope("session", new SessionScope());
factory.registerScope("request", new RequestScope());
}
/* some protected methods here */
}
Run Code Online (Sandbox Code Playgroud)
这是运行测试时的错误消息:
FAILED CONFIGURATION: @BeforeTest registerWebScopes
java.lang.NullPointerException
at my.MyBaseTest.registerWebScopes(MyBaseTest.java:22)
我通常在类声明上使用 Ctrl + T(右键单击菜单上的快速类型层次结构)以在弹出窗口中查看其子类列表。
这个弹出窗口的问题是一次只能打开一个子类。我似乎无法使用 shift 并阻止所有类的子类并在 IDE 上打开它们的所有编辑器。
现在,我必须不断提醒自己最后打开的子类是什么,并开始打开下一个子类。
有任何想法吗 ?