0
我有@ViewScoped
@ManagedBean
与@RequestParam
来初始化我的@PostConstruct
方法中的某些内容。在@ViewScoped Bean中使用AJAX焊接@RequestParam
@ManagedBean @ViewScoped
public class MyBean implements Serializable
{
@javax.inject.Inject
@org.jboss.solder.servlet.http.RequestParam("id")
private long id;
@PostConstruct
public void init() {...}
...
}
的ID与像test.jsf?id=1357
调用正确的注射,但现在我想添加一些p:ajax
东西在我的XHTML页面。如果我删除了@Inject @RequestParam
(并在init()
硬编码的id
)这工作正常,但如果我想使用此注射没有任何反应和萤火虫给了我这样的响应:
<partial-response><error>
<error-name>class java.lang.IllegalStateException</error-name>
<error-message><![CDATA[Can not set long field MyBean.id to null value]]></error-message>
</error></partial-response>
在
更改类型private Long id
结果
<partial-response><error>
<error-name>class java.lang.IllegalStateException</error-name>
<error-message><![CDATA[]]></error-message>
</error></partial-response>
如何在@ViewScoped
Bean中使用@RequestParam
?
我不知道缝焊接是什么,它应该做的,但你可以用标准的JSF2''标签实现相同的基本功能要求。 –
BalusC
2012-02-06 16:06:12
谢谢你的解决方法,目前我已经删除了@Inject @ RequestParam并使用了''。 –
Thor
2012-02-08 07:30:58