You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Sathesh Kumar <fo...@opensymphony.com> on 2007/11/01 13:07:03 UTC

How to get web application file path from java stand alone program?

Hi all,
        I am using Jboss server with struts.I used java class for getting the real path 
of web application.This class iscalled  by my Sheduler class that is run automatically when application server start and not called by Action class.
        How I get web application path from my java class?

Here is my code

class MyJavaClss
{

static getPath()
{
String path="";  // How I get the path of "... //webroot//report/report.xml"
}

}

In Action class I can do with

getServlet().getServletContext().geRealPath("\\report\\JReports\\summary\\");

It gives currect path like

C:\jboss-4.0.1sp1\server\default\deploy\united.war\report\JReports\summary

But how I get this path from my Java Class (not struts Action class)
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=151372&messageID=224111#224111


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: How to get web application file path from java stand alone program?

Posted by Dave Newton <ne...@yahoo.com>.
Please ask questions like this on the struts-user
mailing list, struts-dev is for the development of
struts itself.

Thanks,
Dave

--- Sathesh Kumar <fo...@opensymphony.com>
wrote:

> Hi all,
>         I am using Jboss server with struts.I used
> java class for getting the real path 
> of web application.This class iscalled  by my
> Sheduler class that is run automatically when
> application server start and not called by Action
> class.
>         How I get web application path from my java
> class?
> 
> Here is my code
> 
> class MyJavaClss
> {
> 
> static getPath()
> {
> String path="";  // How I get the path of "...
> //webroot//report/report.xml"
> }
> 
> }
> 
> In Action class I can do with
> 
>
getServlet().getServletContext().geRealPath("\\report\\JReports\\summary\\");
> 
> It gives currect path like
> 
>
C:\jboss-4.0.1sp1\server\default\deploy\united.war\report\JReports\summary
> 
> But how I get this path from my Java Class (not
> struts Action class)
>
---------------------------------------------------------------------
> Posted via Jive Forums
>
http://forums.opensymphony.com/thread.jspa?threadID=151372&messageID=224111#224111
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> dev-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org