Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get strut applications root directory

 
Swathi Prakash
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai ,


plz help me . i m new to struts.i want to get my application directory in my action java file.

i specified the root in context path. i want to get that one.

i used this thing to get the root of my application.

getServletContext().getServletConfig().getRealpath("");

i got error.my application directory which i mentioned is c:\project
i want to get that root. please help mee........

Swathi
 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add a / to the string argument to getRealpath, ie: getRealPath("/")
 
Swathi Prakash
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank u Ray . i Got the Answer..


Swathi

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic