• 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

Getting name of servlet

 
Ranch Hand
Posts: 430
Android VI Editor Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a way i can find out the name of the Action Path that triggers a specific Action?

For example if my struts-config.xml had the following entry..



How can i from the ViewCustomerAction determine the action path (i.e. viewCustomer)?

I have tried this.getClass but its returning the name of the class. I need the name of the path in the url.

Thanks

[ May 08, 2006: Message edited by: O. Ziggy ]
[ May 08, 2006: Message edited by: O. Ziggy ]
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a Struts question, moving to the Struts forum.

Dave.
 
O. Ziggy
Ranch Hand
Posts: 430
Android VI Editor Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

http://struts.apache.org/struts-action/struts-core/apidocs/org/apache/struts/config/ActionConfig.html
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic