omnifaces

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

Navigate to a different page in preRenderViewEvent depending on user permission; ExternalContext#dispatch() does not work

自古美人都是妖i 提交于 2019-12-29 08:13:31
问题 The page should be rendered only if user has permissions to see it. I try to achieve that by performing a check in PreRenderView event listener method: <f:event type="preRenderView" listener="#{theBean.init}" /> And the method itself: public void init() { if (user.havePermission()) { // backing bean init } else { FacesContext fc = FacesContext.getCurrentInstance(); ExternalContext ec = fc.getExternalContext(); ec.getRequestMap().put("message", no_permissions_message); try { ec.dispatch(ec

FullAjaxExceptionHandler does not show session expired error page on ajax button

我的梦境 提交于 2019-12-28 18:45:29
问题 I have implemented Omnifaces FullAjaxExceptionHandler but the problem is It is not working with ajax requests. After session expires when I click to non-ajax button, It works well. It redirects user to custom error page. But if the button uses ajax, It doesn't do anything. Page just stucks. Edit: I have changed ActionListener to Action and still same. Edit2: It gives no error. Neither Apache Tomcat output nor Apache Tomcat Log. here is my spring security; <http auto-config='true' use

FullAjaxExceptionHandler does not show session expired error page on ajax button

こ雲淡風輕ζ 提交于 2019-12-28 18:45:29
问题 I have implemented Omnifaces FullAjaxExceptionHandler but the problem is It is not working with ajax requests. After session expires when I click to non-ajax button, It works well. It redirects user to custom error page. But if the button uses ajax, It doesn't do anything. Page just stucks. Edit: I have changed ActionListener to Action and still same. Edit2: It gives no error. Neither Apache Tomcat output nor Apache Tomcat Log. here is my spring security; <http auto-config='true' use

Pass an object between @ViewScoped beans without using GET params

纵然是瞬间 提交于 2019-12-27 10:30:28
问题 I have a browse.xhtml where I browse a list of cars and I want to view the details of the car in details.xhtml when a "View more" button is pressed. Their backing beans are @ViewScoped and are called BrowseBean and DetailsBean , respectively. Now, I wouldn't like the user/client to see the car ID in the URL, so I would like to avoid using GET params, as presented here and here. Is there any way to achieve this? I'm using Mojarra 2.2.8 with PrimeFaces 5 and OmniFaces 1.8.1. 回答1: Depends on

Pass an object between @ViewScoped beans without using GET params

好久不见. 提交于 2019-12-27 10:30:09
问题 I have a browse.xhtml where I browse a list of cars and I want to view the details of the car in details.xhtml when a "View more" button is pressed. Their backing beans are @ViewScoped and are called BrowseBean and DetailsBean , respectively. Now, I wouldn't like the user/client to see the car ID in the URL, so I would like to avoid using GET params, as presented here and here. Is there any way to achieve this? I'm using Mojarra 2.2.8 with PrimeFaces 5 and OmniFaces 1.8.1. 回答1: Depends on

Pass an object between @ViewScoped beans without using GET params

筅森魡賤 提交于 2019-12-27 10:29:20
问题 I have a browse.xhtml where I browse a list of cars and I want to view the details of the car in details.xhtml when a "View more" button is pressed. Their backing beans are @ViewScoped and are called BrowseBean and DetailsBean , respectively. Now, I wouldn't like the user/client to see the car ID in the URL, so I would like to avoid using GET params, as presented here and here. Is there any way to achieve this? I'm using Mojarra 2.2.8 with PrimeFaces 5 and OmniFaces 1.8.1. 回答1: Depends on

OmniFaces highlight does not set focus with <p:ajax>

断了今生、忘了曾经 提交于 2019-12-24 15:19:54
问题 I got a simple login form. I am using <p:ajax> to invoke a <p:blockUI> (see this question). <h:commandButton id="anmeldung_button" action="#{benutzerAnmeldung.anmelden}" value="Anmelden" styleClass="btn btn-info btn-sm"> <p:ajax process="@form" update="@form"/> </h:commandButton> <p:blockUI id="block" block=":anmeldung" trigger="anmeldung_button" /> I am using <o:highlight /> to highlight invalid inputs. This works fine. It is working with a <f:ajax> perfectly, too. Apperently, it is not

Omnifaces Faces.redirect loses conversation scope

安稳与你 提交于 2019-12-24 13:14:15
问题 I have problem with org.omnifaces.util.Faces#redirect and conversation scoped bean: there is a button <p:commandButton action="#{navigationHandler.gotoCreateCar}" actionListener="#{createHandler.init(searchHandler.search())} value="#{msg.search}" update=":articleSearchForm"> <f:param name="cid" value="#{javax.enterprise.context.conversation.id}"/> </p:commandButton> which must do a navigation to createCar page within the same conversation scope after init of my conversation scoped bean:

OmniFaces validateOrder disabling

末鹿安然 提交于 2019-12-24 06:45:07
问题 I'm trying to use validateOrder component to validate two java.util.Date objects. It is similar to showcase example on this link (PrimeFaces example). Everything works perfect, but i have one question: What if 2nd date field is not required? In that case i'm getting nullpointer exception, and since validateOrder has "disabled" attribute, i was wondering is it worth/possible enabling/disabling it via ajax every time the 2nd date is inserted/removed. If not, i guess i'll stick to Balus'