jsf-2

Are ViewScoped beans serialized to the page when client state saving is turned on?

六月ゝ 毕业季﹏ 提交于 2020-01-01 05:04:31
问题 We have client state saving turned on and use ViewScoped backing beans. When client state saving is turned on and we are using a ViewScoped bean, is the ViewScoped bean serialzied to the page or is it say, stored in session with a token/key that is serialized to the page (so that the page can recall the bean from session if the page is posted-back to itself) A concern here might be that, if it is serialized, then we might want to then worry about not storing large instance variables on the

Migrate JSF managed beans to CDI managed beans

廉价感情. 提交于 2020-01-01 05:00:07
问题 I'm planning to convert a web app from using JSF managed bean to using CDI managed beans. I know I'll need to do below: Add a empty beans.xml file in WEB-INF. Replace all JSF @ManagedBean to CDI @Named annotations. Replace all JSF scope annotations with CDI or OmniFaces scope annotations. Replace all JSF @ManagedProperty with CDI @Inject annotations. Is that all that needs to be done? Are there any gotchas that I need to be aware of? 回答1: Basically, that's indeed all you need to do provided

How to redirect to the login page when the session expires?

こ雲淡風輕ζ 提交于 2020-01-01 03:46:33
问题 I have three JSF 2.0 web modules and I need to redirect to the login page when the session expires. I have tried it using a HttpSessionListener , it is calling the sessionDestroyed() event method, but I am not able to forward/redirect the request in there. I think it is becasue there are no HttpServletRequest and HttpServletResponse objects. I also tried it using a PhaseListener , but it results in a "too many redirects" error in the webbrowser. public class SessionListener implements

JSF Validator compare to Strings for Equality

故事扮演 提交于 2020-01-01 03:35:07
问题 How would you compare two string for equality in a JSF Validator? if (!settingsBean.getNewPassword().equals(settingsBean.getConfirmPassword())) { save = false; FacesUtils.addErrorMessage(null, "Password and Confirm Password are not same", null); } 回答1: Use a normal Validator and pass the value of first component as attribute of second component. <h:inputSecret id="password" binding="#{passwordComponent}" value="#{bean.password}" required="true" requiredMessage="Please enter password"

Primefaces how to update content in a dialog and keep the dialog centered?

烂漫一生 提交于 2019-12-31 10:21:19
问题 I have a dialog that contains no content on page load and I'm dynamically setting the content of a dialog box based on the link that a user clicks on. <p:dialog widgetVar="dlg" modal="true" id="dialog"> <p:panel id="fullArticle"> <h:outputText value="#{content.newsArticle}" escape="false" /> </p:panel> </p:dialog> ... ... <p:commandLink value="Read more" actionListener="#{content.getFullArticle}" onclick='dlg.show();' update=":fullArticle"> <f:attribute name="contentId" value="#{news

Java EE vs JSP vs JSF [closed]

大城市里の小女人 提交于 2019-12-31 08:28:41
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . I am looking to learning a Java technology for developing web applications. As I looked more into this, I became confused between jsf, jsp, and javaee. I know there are several posts on SO (post 1, post 2) which attempt to resolve these confusions, I have a few more on top of

Set Focus for Primefaces Component in Bean with WidgetVar with RequestContex Execute

不羁岁月 提交于 2019-12-31 07:22:08
问题 Is there a way to set my component focus after an function call to an other component with Primefaces RequestContex? i tried: RequestContex.getCurrentInstance().execute("PF('WidgetVar').focus();"); and RequestContex.getCurrentInstance().execute("(((InputText) event.getComponent()).getWidgetVar()).focus();"); I dont get an error but nothing happens. Did i miss something or is this not possible? I use Primefaces 4.0.3 and MyFaces 2.0.2 EDIT Example Code Bean import java.io.Serializable; import

JSF : Issues with File Upload using Icefaces component

女生的网名这么多〃 提交于 2019-12-31 04:59:10
问题 I am trying to get FileUpload feature working with Icefaces ace:fileEntry but my fileUploadListener on server is not called, here is the code: xhtml piece: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ace="http://www.icefaces.org/icefaces/components" xmlns:ice-cc="http://www.icesoft.com/icefaces-composite-comps" xmlns:f="http://java.sun.com/jsf/core" xmlns:ice="http://www.icesoft.com/icefaces/component"> <h:head> <link rel="stylesheet" type="text/css

How to reference value declared in cc:attribute in cc:implementation

蓝咒 提交于 2019-12-31 04:30:09
问题 I have a simple JSF 2.0 composite component example. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:cc="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"> <head> <title> A panel box component </title> </head> <body> <cc:interface> <cc:attribute name="model" required

Modifying JSF Component Tree in PhaseListener

蹲街弑〆低调 提交于 2019-12-31 04:09:09
问题 I'm having an issue. I've implemented a PhaseListener, which is meant to add a style class to any UIInput components in the tree that have messages attached to them, and removes the style class if it doesn't have any messages attached to them. The PhaseListener runs in the RENDER_RESPONSE phase, and does it's work in both the beforePhase and afterPhase methods while debugging. While debugging, I found that beforePhase doesn't have access to the full component tree, but afterPhase does. Any