view-scope

How to put data in view scope via EL in JSF page

瘦欲@ 提交于 2019-12-01 06:58:37
问题 In my JSF page this works: ${requestScope.put('test', 'data')} ${requestScope.get('test')} This causes exception: ${viewScope.put('test', 'data')} ${viewScope.get('test')} Exception: java.lang.NullPointerException javax.el.BeanELResolver.invoke(BeanELResolver.java:159) javax.el.CompositeELResolver.invoke(CompositeELResolver.java:84) org.apache.el.parser.AstValue.getValue(AstValue.java:157) org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184) com.sun.faces.facelets.el

ViewExpiredException when i use @ViewScoped

老子叫甜甜 提交于 2019-11-30 16:07:02
问题 I have problem with my h:commandButton "Login": when I use @ViewScoped and push this button there is ViewExpiredException, but when I use @SessionScoped, there isn't any error. Stack Trace: javax.faces.application.ViewExpiredException: /pages/register.xhtmlNo saved view state could be found for the view identifier: /pages/register.xhtml at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:132) at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase

Does f:viewParam only pass query string in url when first page uses the same managed bean as the second page?

╄→尐↘猪︶ㄣ 提交于 2019-11-30 15:45:52
Let's use a search page and a results page for example. If i have a ViewScoped bean that handles my search page and my results page, i'm able to pass parameters through the url using something like this: search.xhtml <p:commandButton value="Search" type="submit" action="#{searchBacker.search}" > backing bean @ManagedBean(name="search") @ViewScoped public class searchBacker extends AbstractBacking { private String firstName = null; private String lastName = null; private String results = null; public String search() { return "results?faces-redirect=true&includeViewParams=true"; } public void

@ViewScoped Managed bean loads many times during postback

浪尽此生 提交于 2019-11-30 09:33:40
I have a calendar, editor, fileUpload and a dataTable primefaces controls on a jsf facelet. Code is as follows, <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" template="./../templates/masterlayout.xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:f="http://java.sun.com/jsf/core"> <ui:define name="title">#{lbl.SSTitle}</ui:define> <ui:define name="content"> <h:form> <p

Linked ViewScoped beans lead to memory leaks

☆樱花仙子☆ 提交于 2019-11-30 09:20:30
In our JavaEE6 project (EJB3, JSF2) on JBoss 7.1.1, it seems we have a memory leak with @ViewScoped beans. Last tree days I've spent time on this issue investigation. So i've created simple project with two pages to guarantee that after first page leaving @ViewScoped bean will be released. <context-param> //web.xml <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>server</param-value> </context-param> <context-param> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name> <param-value>false</param-value> </context-param> TreeBean.java @ManagedBean @ViewScoped public class

ViewExpiredException: No saved view state could be found: on submitting a form in JSF

别来无恙 提交于 2019-11-30 04:12:54
I get the below exception while trying to submit a form. javax.faces.application.ViewExpiredException: /page1.xhtml No saved view state could be found for the view identifier: /page1.xhtml at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:132) at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170) at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain

Does f:viewParam only pass query string in url when first page uses the same managed bean as the second page?

混江龙づ霸主 提交于 2019-11-29 22:49:49
问题 Let's use a search page and a results page for example. If i have a ViewScoped bean that handles my search page and my results page, i'm able to pass parameters through the url using something like this: search.xhtml <p:commandButton value="Search" type="submit" action="#{searchBacker.search}" > backing bean @ManagedBean(name="search") @ViewScoped public class searchBacker extends AbstractBacking { private String firstName = null; private String lastName = null; private String results = null;

ViewExpiredException: No saved view state could be found: on submitting a form in JSF

删除回忆录丶 提交于 2019-11-29 01:01:34
问题 I get the below exception while trying to submit a form. javax.faces.application.ViewExpiredException: /page1.xhtml No saved view state could be found for the view identifier: /page1.xhtml at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:132) at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170) at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117) at javax.faces.webapp.FacesServlet.service(FacesServlet

@PostConstruct method is called even if the ManagedBean has already been instantiated (e.g. on AJAX-calls) [duplicate]

孤人 提交于 2019-11-28 23:43:56
This question already has an answer here: @ViewScoped calls @PostConstruct on every postback request 1 answer I have a @ViewScope ManagedBean and a @PostConstruct initialisation method. This method is called when a new instance is created, but also on every ajax call. Why is this so? On an AJAX-call the init-Method is called and executed, but no changes are visible. For example if I change a property in the init-Method, this is only visible on instatiation and not for AJAX-calls. For AJAX-calls the value change is not persistent in the @ViewScoped Bean. Can anyone tell why this is so? How can

JSF View Scoped Bean Reconstructed Multiple Times [duplicate]

谁都会走 提交于 2019-11-28 11:45:51
This question already has an answer here: @ViewScoped calls @PostConstruct on every postback request 1 answer I thought @ViewScoped was supposed to prevent the bean from being reconstructed while the user is on the same page... So why is my @ViewScoped JSf controller bean being created multiple times even before the action handler causes the browser to navigate away from that view? Can anyone point me in the right direction here? Here is my code: The View (domain/edit.xhtml) <h:form prependId="false"> <h:inputText id="descriptionField" value="#{domainEdit.domain.description}" /> <h