Hi,

If the path is exact with respect to root directory you don't have to do it.
But...


You use
file_location = this.getServletContext().getRealPath("file.y"); that gives
the full path on the system i.e.
/usr/webserver/x/file.y on solaris
and c:\webserver/x/file.y on WINDOWS


instead of
file_location = "/usr/webserver/x/file.y"  on say solaris
file_location = "c:\webserver/x/file.y"  on WINDOWS
witch means that you have to have different JSP code on different platforms.
If you use getRealPath() you only need to know where to put the file on each
system.

I used it when I needed to pass the location of a properties file to a bean.

/Nils

>From: sandarbh <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>     reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: java code for access to file (JSP)
>Date: Tue, 30 Jan 2001 18:55:32 -0000
>
>hi Nils
>if the path is exactly duplicated with respect to root directory still this
>has to be done??
>regards
>sandarbh
>----- Original Message -----
>From: "Nils Janson" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Tuesday, January 30, 2001 6:36 PM
>Subject: Re: java code for access to file (JSP)
>
>
> > Hi,
> >
> > You can use something like this
> > this.getServletContext().getRealPath("file.y")
> >
> > You only need to figure out the path return on NT and Solaris. In this
>way
> > you don't have to change your JSP code.
> >
> > Hopes it helps.
> > Nils
> >
> >
> > >From: sandarbh <[EMAIL PROTECTED]>
> > >Reply-To: A mailing list about Java Server Pages specification and
> > >     reference <[EMAIL PROTECTED]>
> > >To: [EMAIL PROTECTED]
> > >Subject: java code for access to file (JSP)
> > >Date: Tue, 30 Jan 2001 11:14:02 -0000
> > >
> > >hi all,
> > >I want to write a code that needs to access files, at the  moment the
> > >platform is NT, now can a code for a file y in x directory for NT stand
> > >good
> > >for a filey in x directory on a sun solaris platform, will there be any
> > >change in code required. Web server is weblogic 6.0
> > >thanks
> > >Sandarbh
> > >
> >
> >===========================================================================
> > >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > >JSP-INTEREST".
> > >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > >DIGEST".
> > >Some relevant FAQs on JSP/Servlets can be found at:
> > >
> > >  http://java.sun.com/products/jsp/faq.html
> > >  http://www.esperanto.org.nz/jsp/jspfaq.html
> > >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
> > _________________________________________________________________
> > Get your FREE download of MSN Explorer at http://explorer.msn.com
> >
> >
>===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to