• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ActionClass.execute

 
Amy Medrat
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All, Need some help.

I want to get the real path of a file and then using this path perform some operation within the action class.
In servlets we used to have servletcontext.getrealpath("file name"),
but within the ActionClass.execute() method how can i get the same information.

Thanks,
[ March 22, 2006: Message edited by: Amy Medrat ]
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have not tried this, but you can get the ServletContext using:
request.getSession().getServletContext()

- Brent
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Action class that your action extends also has a getServlet() method, which returns the ActionServlet instance. Once you have this object, you can get the ServletContext and any other objects you would normally get from your own servlet in a non-Struts application.
 
Amy Medrat
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much Brent and Merrill.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic