What you want is probably in the ActionMapping, if this isn't what you were looking for. Since the servlet can actually be mapped to many different Actions, the servlet itself won't know where it came from.
Why do you need to know the Action the servlet is being called from? Debugging? You probably shouldn't have specific functionality tied to which mapping your servlet is using. I would break these out into specific Action classes if you are.
Originally posted by Joseph Erickson: In your servlet, try:
What you want is probably in the ActionMapping, if this isn't what you were looking for. Since the servlet can actually be mapped to many different Actions, the servlet itself won't know where it came from.
Why do you need to know the Action the servlet is being called from? Debugging? You probably shouldn't have specific functionality tied to which mapping your servlet is using. I would break these out into specific Action classes if you are.
Do you think its better if i use the class name and determine from that what Action was executed?
Joseph Erickson
Greenhorn
Joined: May 05, 2006
Posts: 10
posted
0
If you want to know what Action was executed, mapping.getPath() is the way to go. I just wondered why you needed to know.
There's a lot of good data you can get about how your action was called from the ActionMapping object that gets passed into your execute() method. Might help you with what you're doing.