This week's book giveaway is in the
Agile and other Processes
forum.
We're giving away four copies of
The Mikado Method
and have Ola Ellnestam and Daniel Brolund on-line!
See
this thread
for details.
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Frameworks
»
Struts
Author
Struts2 Accessing a web folder in action class
Harsha Pherwani
Greenhorn
Joined: Jul 11, 2005
Posts: 27
posted
Feb 27, 2009 19:28:18
0
Hi all,
In the action class, I would like to access the images folder located in the application alongside WEB-INF.
The directory structure looks like this -
Tomcat
-> webapps -> app
-> images
-> jsp
-> WEB-INF
Is there a
struts
api that gives me the absolute path till the application?
Thanks!
Harsha
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
Feb 28, 2009 08:02:49
0
There's no Struts 2 API for that; you'd just use the regular ServletContext.getRealPath().
You can either implement ServletContextAware or use the ServletActionContext utility class.
Harsha Pherwani
Greenhorn
Joined: Jul 11, 2005
Posts: 27
posted
Feb 28, 2009 11:04:45
0
Thanks David. I got the
ServletContext
instance from ServletActionContext and it works as I want it to.
Thanks!
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: Struts2 Accessing a web folder in action class
Similar Threads
web app structure
fragment was not found error
Getting out of WEB-INF
what is document root?
invalid console appender .....
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter