Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Multiple users login

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, im doing this system, where there are a login page and a profile, when you login you can enter the profile with your info based on your username offcourse, but in my project i can only login with one user, example, i use chrome to login succesfully, then if i open the project in another browser (chrome, explorer, etc) it redirects me to the profile page that i login before in the first browser. Im using SessionScoped, to validate a static variable (which is i think the problem is, but when i use it as non static, the variable wont save), something like, if the username and password exist in the BD you can log in, then the static variable authLogin is true and you can access to the profile.

I tried fix this using anotations, Stateless, Stateful, changing the Scope... but nothing works

Example of code

Validation User


Then the check if the user if logged



I repeat, it works with one user, but i need it for "n" users

I read that maybe i need multi tenant, o managing threads, and i find a lot of theory, but no sample codes that use J2EE

My files...

Login
 Java EE Modules...

Login.ejb
 Source Package
   -->entity
        lot of stuff
   -->session beans
        to persists, edit, etc....

Login.war
  Web Pages
   -->login.xhtml
   -->profile.xhtml
  Source Package
   -->usr
       -->checkUser.java
       -->authBean.java

My server: Glassfish

Thanks, and sorry for the lame english :/
 
Rancher
Posts: 904
22
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So are you using sockets? Web server? or are you just logging to your single session and trying to get multiuser... :0

You need to either be using a web server or using sockets and writing your own server.
 
Sam Castaño
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Les Morgan wrote:So are you using sockets? Web server? or are you just logging to your single session and trying to get multiuser... :0

You need to either be using a web server or using sockets and writing your own server.



Hi, web server, and i did it, thanks to @ManageProperty passing a value betwen beans and keep them on session, saving memory, and making it for multiple users, Thanks anyway
 
Tomorrow is the first day of the new metric calendar. Comfort me tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic