Win a copy of Murach's MySQL this week in the JDBC and Relational Databases 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regarding session

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,

I want to do one program ,where i want to set the session.

If the user entered into the page without login should not be allowed.

For example if the knows the address of the page he should not allowed to login in directly without proper login.

I know how to use the Javabean.In the page how i will check he is logined user?

please help me
thanks
priya
 
Sheriff
Posts: 67745
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Checking on the page is a very poor place to do it. Rather, you should check before the page is even displayed in a Servlet filter.
 
Ranch Hand
Posts: 59
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. In this case, you can use the security options of your container (Tomcat, JBoss, etc). You can use Tomcat with JDBC Realm. The login page need to have an input named "j_username", other input named "j_password" and the action of the form "j_security_check". There is an excelent example about it in the book Head First - Servlets and JSP.

References:
Tomcat Realms
 
Bear Bibeault
Sheriff
Posts: 67745
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds like he already has a login mechanism, why would he switch to the container-managed login which offers little in the way of control?
 
Danilo Dadonas
Ranch Hand
Posts: 59
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think he means that if someone knows some url that requires authenticated access like http://www.myapplication.com/reports/somereport.jsp.
If "/reports/*" or "/reports/somereport.jsp" are referenced in the <security-constraint> of the Deployment Decriptor, the container will submit the user to the login page if the one is not logged on. In this case, anyone code is necessary to check if the user is logged on, the container does the work.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Priya,

You can also search the forum for existing threads on the topic. One good link is here

Friends,

Priya is a she not a he.



Thanks,
Suraj
 
It's a tiny ad. At least, that's what she said.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic