Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Getting name of servlet

 
Ranch Hand
Posts: 430
Android VI Editor Debian
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
 
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic