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
- I need the BIRT.war that is compatible with Java 17 and Tomcat 10
- Creating global Class holder
- No method found for class java.lang.String in Kafka
- Issue edit a jtable with a pictures
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
- Mixed color rendering in a JTable
- HTTPS configuration in Spring Boot, server returning timeout
- How to use Layout to create textfields which dont increase in size?
- Function for making the code wait in javafx
- How to create beans of the same class for multiple template parameters in Spring
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Accessing Secret Variables in Classic Pipelines through Java app in Azure DevOps
- Postgres && statement Error in Mybatis Mapper?
Related Questions in SESSION
- Multiple Processes, Multiple Processors, Single Priority Queue - Java Thread-Safe and Concurrency -
- Securing routes with sessionStorage in NextJS
- Cant handle Session's cookie when Safari/iOS
- Quart_Sessions Redis deletes keys and create backups instead
- I cannot get ID from session in GET method in Next.js 14
- I am new to flutter, just trying to set and get logged in user's session but maybe I am missing something
- I'm going nuts with Heroku session management issues
- Have a problem with get session in nextjs
- Session custom property getting undefined when calling Node js API from Javascript fetch
- Best Approach for Preserving User Input Across Blazor Pages in ASP.NET Core Application with User-Specific Data Storage
- spring security + form login + redis session storage -> keep coming out anonymous User
- Check user login in backend
- Next.js Middleware for Session Authentication Redirects: Errors Encountered
- Ansible prompt "No existing session" in manual executing the playbook
- Running a program on different computers with different users that access a central database simultaneously - VB.NET XAMPP/MySQL
Related Questions in JSF-2
- JSF 2 Primefaces : On Ajax reponse I can see extra updates sent by server <update id="javax.faces.Resource"> and which cause my action skipped
- Understanding HTTP sessions in JSF as session attributres are going null unexpectedly while working actively on the application
- How to clear data from datatable using primefaces and java
- CDI Interceptor fires BEFORE HttpAuthenticationMechanism validates request
- JSF user lockout after X failed login attempts
- JSF ExceptionHandler - Response already committed in some cases
- Why am I getting Class NotFound Exception using data table with jsf
- Java Beans - how to ignore boolean isXXXXMethod in favor of BOOLEAN getXXXXMethod in JSF page?
- Input element created with h:inputText is not editable
- NullPointerException during initFaces of a MyFaces 2.0 application while migrating from WLS to Tomcat
- Primefaces 10 HTML styling in DataTable emptyMessage
- jsf2, primefaces 11, Component ID j_idt20 has already been found in the view
- Hide rows of datatable based on condition in JSF2
- How to generate and preview a presigned url of a file in jsf?
- commandLink action parameter not displayed in JSF2
Related Questions in MANAGED-BEAN
- Problema with managedbean null, but system out work
- Why does my managed beans are not working?
- Best practice for storing and reading data from Java Beans in XPages
- @ViewScoped bean behaves like @SessionScoped or @ApplicationScoped
- jakarta.servlet.ServletContext from jakarta.faces.context.FacesContext to getAttribute("AnAttributeName")
- CDI injection of subclasses of session scoped beans as a managed property
- Get JSF managed bean by name in a Servlet
- JSF - Appropriate bean scope for keeping data between pages but only "browser tab related"
- javax.faces.component.UpdateModelException: javax.el.PropertyNotFoundException. Target Unreachable, identifier resolved to null
- How to pass a variable value from one xhtml to another xhtml and then to the backing ManagedBean of 2nd xhtml
- faces-config.xml keep updating itself
- How to determine coordinates of different areas in h:graphicImage
- JSF cant resolve bean in xhtml file using spring boot
- faces-config.xml is being overwitten
- search and display person by id in jsf
Related Questions in SESSION-SCOPE
- Multipartfile stored empty in session?
- Simple Springboot Session Scope usage Issue with a custom session token
- JSF / Xpages how to clear sessionscopes?
- How to use @SessionScope beans with Vaadin Broadcaster?
- JBoss 7.2 upgrade with JSF - No active contexts for scope type javax.enterprise.context.SessionScoped
- Accessing SessionScoped bean from main thread within the CompletableFuture thread is not working
- Invalidate session followed by redirect recreates the bean
- Spring Boot2.0 - @SessonScope cannot be updated and is not reflected in HttpSession
- I want to access my Session variable during my bean creation time
- @SessionScoped beans CDI using Bootsfaces/Primefaces
- How does Spring autowire session scoped beans?
- Fail during start Tomcat v9.0 CDI annotations
- Destroy all session scoped bean of a class
- Updating session variables kick user to login page or not?
- Spring boot - setters on session scoped component not working from singleton service - fields are null
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 # Hahtags
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.