• 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

jsp-servletListener

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all,
I have I problem: I construct for the first time HttpBindingListiner; valueBound, for input data from database into session on

witch will occure in someJsp.jsp. But to get file from database I need an information about that particular user witch for who session is; like user_id - to make some query. So I need somehow to forward that information in valeBound, because that information must be ready before session is created.
In jsp:

I had try with setRequest, but I cant getRequest from valueBound, because it must be called from doPost, and when I put doPost, then Listeners wont work inside it.

Plese help
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't see the relation between getSession and a BindingListener...
Maybe you're looking for HttpSessionListener instead.
 
Marko Debac
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are talking about HttpSessionBindingListiner, who is triggered on create session(valueBound) and on destroy session(valueUnbound)
 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Marko Debac, if I am not wrong, you want to execute some code before session(valueBound). Am I right?
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, the SessionBindingListener is fired when an object is put into session, not when a session is created.

User user = new User("Bob");
session.setAttribute("user", user);

At this point a SessionBindingEvent would get fired on the "user" object.

Your User object is what implements the interface so you would have

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if I've got your question right: you want to authenticate the user & have the login info before anything else.
authenticate the user making the request by any of the four authentication methods:
Basic authentication.
Client Certificate authentication.
Digest authentication.
Form authentication.

Once the user authenticated you can obtain the login of the user from the request object:
java.lang.String httpServletRequest.getRemoteUser().
There is more to Java security, authentication / authorization; have barely scratched the surface n you've set me on the trail. have experimented with Basic and Form authentication.
am requesting the ranch rangers to suggest resources n hard books to start off with.
 
reply
    Bookmark Topic Watch Topic
  • New Topic