I'm building a web application using jsf2. I use a @ManagedBean with a @SessionScope. In it I store the username etc in a User object. Let's say I want to create an article, for that I have another @ManagedBean @RequestScope that has a createArticle() method, but it needs to set the article author. Should I inject the user session bean through cdi to get the user user object, is it ok to inject managedbeans into other managed beans? May be is there any other approach to would be better?
Handling user session in jsf 2
1.5k Views Asked by arg20 At
1
There are 1 best solutions below
Related Questions in JAVA
- Add image to JCheckBoxMenuItem
- How to access invisible Unordered List element with Selenium WebDriver using Java
- Inheritance in Java, apparent type vs actual type
- Java catch the ball Game
- Access objects variable & method by name
- GridBagLayout is displaying JTextField and JTextArea as short, vertical lines
- Perform a task each interval
- Compound classes stored in an array are not accessible in selenium java
- How to avoid concurrent access to a resource?
- Why does processing goes slower on implementing try catch block in java?
- Redirect inside java interceptor
- Push toolbar content below statusbar
- Animation in Java on top of JPanel
- JPA - How to query with a LIKE operator in combination with an AttributeConverter
- Java Assign a Value to an array cell
Related Questions in SESSION
- Access property of an object of type [Model] in JQuery
- __PHP_Incomplete_Class Object even though class is included before session started
- Safari Extension not geting session Info
- Laravel: Locale Session: Controller gets Parameter to change it but it cant. U have to hardcode it
- Does OPEN SYMMETRIC KEY (SQL Server) remain in scope on a server farm?
- Superagent share session / cookie info with actual browser
- Session Destroyed on page refresh
- MVC Referencing strongly typed session objects on my view
- What is the best way to persist a global array in php?
- Error in indicies while unsetting Sessions
- Server side PHP session is not working in android
- Laravel - session data survives log-out/log-in, even for different users
- The page isn't redirecting properly when I logout
- Session array unset and delete row
- Validating a login using PHP
Related Questions in JSF-2
- Strange java.lang.ArrayIndexOutOfBoundsException rendering error in jsf application under high load
- Ajax-update only a component attribute, not the whole component nor its children
- How to instantiate a backing bean on page load
- How to add '%' symbol in textbox using jsf and jsp?
- Primefaces datatable duplicate "No records found" while doing column freeze for empty records
- How to provide a file download from a JSF backing bean using af:commandMenuItem?
- Using multiple FluidGrids in one form
- Masks in JSF2 with rich:jQuery?
- IceFaces message not showing
- Add table plugin to primefaces editor
- this.jq.draggable is not a function when using primefaces dialog framework
- Setting f:setPropertyActionListener value with a f:param value
- It is possible to download file on p:poll
- Spring Boot with Jsf views
- JSF, Target unreachable
Related Questions in MANAGED-BEAN
- How to instantiate a backing bean on page load
- Expire specific managed bean instance after time interval
- Unit-testing bean-initialization
- Spring managed bean subclass can't access protected service from superclass
- Can @ManagedBean and @XxxScope be placed in a base class?
- Sessionscoped managed bean not saving variables jsf
- Disable scanning of CDI beans in WAR
- action p:command button doesn't set property into managed bean
- null bean in selectOneMenu
- How to set bean class at runtime
- How to set a value to a bean property from a JavaScript async callback
- JSF - Using different instances of ManagedBean for same view in Primefaces wizard
- Set actionListener of primefaces CommandButton object in managed bean using binding
- How to use enum with switch statement?
- valueChangeListener isn't always triggered depending on the rendered attribute
Related Questions in SESSION-SCOPE
- Is it not possible to directly invoke session.getAttribute() with EL?
- Dirty read of session variables at client side in web application
- Session scoped beans and @PostConstruct in JSF
- Handling user session in jsf 2
- JSF application crossing user session data
- JSF injected sessionscoped bean's method invocation become null pointer
- Caching current user data in a session-scoped variable
- How to pass var to facet in xpages and update facet?
- Session scoped bean behaves as Request scope bean
- Using session-scoped object in singleton in Spring
- Issues While using Scope Based Services in Grails
- Serialization problems using HazelCast with session scoped bean
- Simple Springboot Session Scope usage Issue with a custom session token
- Access session scoped bean from request scoped bean
- RequestFilter and SessionBean for authorisation
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The whole point of Dependency Injection is to inject managed beans into other managed beans. So yes, your approach is the way to go.