| Author |
jsp-servletListener
|
Marko Debac
Ranch Hand
Joined: Aug 21, 2006
Posts: 121
|
|
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
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14670
|
|
I can't see the relation between getSession and a BindingListener... Maybe you're looking for HttpSessionListener instead.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Marko Debac
Ranch Hand
Joined: Aug 21, 2006
Posts: 121
|
|
|
We are talking about HttpSessionBindingListiner, who is triggered on create session(valueBound) and on destroy session(valueUnbound)
|
 |
Chetan Parekh
Ranch Hand
Joined: Sep 16, 2004
Posts: 3636
|
|
|
Marko Debac, if I am not wrong, you want to execute some code before session(valueBound). Am I right?
|
My blood is tested +ve for Java.
|
 |
Stefan Evans
Bartender
Joined: Jul 06, 2005
Posts: 1002
|
|
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
|
 |
Kaveriappa Poonacha
Greenhorn
Joined: Feb 15, 2006
Posts: 10
|
|
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.
|
 |
 |
|
|
subject: jsp-servletListener
|
|
|