How can i access to a method or getter/setter of a managed bean (e.g. session scoped) in an ivy-script-step ?? asked 06.06.2014 at 13:11 Wanderhirt |
The creation of the object (managed bean) happens automatically, you must not do that by yourself (because you will receive/create another instance!). The point is now to get the correct object (created by faces context usually by the first access!). The code in the script step looks like follows:
The code of the managed bean:
This approach works surely with session or application scoped beans. answered 11.06.2014 at 09:27 Wanderhirt We do it in the same way. But be allways clear on the context of your script step. The FacesContext is clearly definied just after your first JSF-UI appears. Moreover, we have in some cases the problem, that we need special ivy system permission to read SessionBeans in this way, when you call it from different ivy projects (models). The behavior is, that the first bean could be loaded, but for the next one, the server search the Bean in a strange way. So you get an exception like this : ..does not fulfill the permission rule SESSION OWNS ProcessModelVersionReadAll PERMISSION.. --> Issue 24860
(11.06.2014 at 11:12)
Adrian Imfeld
The Issue 24860 should be fixed in Version 5.0.12
(17.06.2014 at 11:34)
Adrian Imfeld
Additional thinkings: If the jsf context scope is a problem and you need to have a session bean after all jsf uis are closed, you can add your bean to the ivy session. Add "Ivy.session().setAttribute("SimpleBean",this);" in the @PostConstruct methode of the bean. To read it you can use "SimpleBean sb = ivy.session().getAttribute("SimpleBean") as SimpleBean;" It is not really sweet way, but it works. Beware of the Ivy context when you use the Ivy-class.
(23.07.2015 at 11:26)
Adrian Imfeld
|
Usually i do that way: First i will create instance:
then i get it when i want to use like this:
answered 10.06.2014 at 11:12 trungdv |
In your Script-Step:
If you want to use this bean in your view just declare a data-object of the given type (de.azt.exampleData.MapBean) in your data-class and bind this as model in your view code, f.e.:
The corresponding code in your script step would then be:
Whereas you need to pass the attributes from your database-query as parameters to the constructor of your bean. Hope that helps. answered 06.06.2014 at 13:43 Nikel Weis |
Once you sign in you will be able to subscribe for any updates here
By RSS:Markdown Basics
Tags:
Asked: 06.06.2014 at 13:11
Seen: 6,184 times
Last updated: 23.07.2015 at 11:54