view-scope

How and when is a @ViewScoped bean destroyed in JSF?

我怕爱的太早我们不能终老 提交于 2019-12-17 04:59:53
问题 The lifecycle of the @RequestScoped and @SessionScopedBean managed beans are managed by the Servlet container itself since they are basically stored as an attribute of HttpRequest and HttpSession respectively. How do JSF manage the lifecycle of the @ViewScopedBean ? I know it gets created when the view is created and is usable till there is a postback to a different view. But I found out that is not garbage collected immediately after we move from that view. 回答1: It will be destroyed when a

@ViewScoped bean recreated on every postback request when using JSF 2.2

守給你的承諾、 提交于 2019-12-17 03:18:15
问题 I'm having an issue similar to this post and the answer from @BalusC with 3 solutions but: I'm not using of the mentioned EL expressions I don't want to go with the second solution (it's complex enough for me like this) and partial state saving is set to false. My code is as follows: index.xhtml : <?xml version="1.0" encoding="windows-1256" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml

jsf 2 passing of value to dialog not working

那年仲夏 提交于 2019-12-14 04:06:16
问题 I want to pass a value to a dialog but it wont work. I have tried this approach but no luck Here is my page: <!DOCTYPE html > <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"> <h:head> <title></title> </h:head> <h:body> <h:form> <p:inputText value="#{myManagedBean.input}"/> <p:commandButton value="edit" onclick="dlg.show()"/> <p:dialog widgetVar="dlg" modal="true"> passed value:<p:inputText value="#{myManagedBean.input}"/> <

@ViewScoped creating new instance on every postback

时光毁灭记忆、已成空白 提交于 2019-12-14 03:44:16
问题 I am having the below managed bean. But every time I do a post back to the same bean ie while calling updateFileList. I get a new instance of FileDAO. How can I prevent this? Is it safe to have a DAO inside a managed bean, if not what changes can I make to better it. @ManagedBean(name = "file") @ViewScoped public class FileController implements Serializable { private static final long serialVersionUID = 1L; private List<LoadFileLog> fileList = null; private Date selectedDate; FileDAO fileDAO;

jsf viewscoped bean - set values for every page(tabs)

回眸只為那壹抹淺笑 提交于 2019-12-13 06:08:16
问题 I am sorry, this might sound really basic but if anyone could explain how to set explicit values for every tabs in the same browser window using the JSF viewscoped bean. Please guide me to some article or working samples. Kindly help, thanks in advance Update: auth-page.xhtml <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"

JSF @ViewScope, PrimeFaces <p:dialog and <ui:include

笑着哭i 提交于 2019-12-13 02:19:10
问题 I have: button on main page and dialog. A would like to have ViewScope life cycle for managed bean (NewDialog.java), what perform the dialog. In other words: recreate the NewDialog bean while pushing the button, and destroy while closing dialog. But NewDialog bean has created while loading main page. How to force bean created only when you press a button? <ui:composition <h:form id="mainForm"> <p:commandButton value="New Dialog" onclick="newDialogVar.show();"/> </h:form> <ui:include src="#

JSF ViewScope - returning null on actions do not update the view

烈酒焚心 提交于 2019-12-12 10:56:36
问题 I have a Managed Bean in ViewScope mode. So, when I call some action from this Managed Bean my page do not update. I see that my action is invoked well and returning null (viewscope work flow is OK). So, what am I doing wrong? If I rerender the page using Ajax it works fine. EDIT: My Versions are: JSF 2.1.14 with Primefaces 3.4.1 My Code: @ManagedBean(name = "test") @ViewScoped public class TestMB implements Serializable { private String status; public String getStatus() { return this.status;

Xpages falling out of server side cache

孤街浪徒 提交于 2019-12-11 10:46:18
问题 This issue may have to do with a very specific Domino version (see below), so I start with a few technical details: Server in question is a virtualized Windows 2008 R2 64bit machine. Domino release is IBM Domino (r) Server (64 Bit) (Release 9.0.1FP4 HF70 for Windows/64) The latest JVM security patch (9.0.1.4 dated 20150724) is installed. I may be wrong but I feel that the issue started after we installed the latest patches ( FP4 HF70 and JVM ): On an Xpage I have a very simple "Refresh" type

How can I know if a viewScope variable has been initialized

耗尽温柔 提交于 2019-12-10 16:19:04
问题 In an application I need to know if a viewScope variable has been initialized. When the viewScope variable is created the value might be null. So viewScope.isEmpty("SomeName") does not tell me that it has been intialized and the answer is null or it has not been initialized yet. None of the viewScope properties seem to answer the question "dose the viewScope exist". 回答1: You can get the information whether a viewScope variable does exist or not with if (viewScope.containsKey("SomeName")) ...

How do you find CDI beans of/in the current view (scope)?

て烟熏妆下的殇ゞ 提交于 2019-12-10 15:16:22
问题 In a Java EE 6, CDI 1.1.x, Seam 3 etc. environment , we need to find all CDI beans of the current view ( @ViewScoped ). What I have tried so far is using: @Named @ViewScoped public class ViewHelper { @Inject private BeanManager beanManager; public doSomethingWithTheBeanInstances() { Set<Bean<?>> beans = this.getBeanManager().getBeans( Object.class, new AnnotationLiteral<Any>(){} ); // do something ... } } However, this returns all beans it manages. I need to find only those within the scope