This will most often work, but not always because the specification doesn't
say anything about the trailing slash at the end of the string returned by
getRealPath("/"). So, with some environements, the trailing slash will be
missing. To insure maximum portability, you have to test the last character
against "/" and add this character if it is not present. Even if your
environment returns the trailing slash, you can't be sure it will do the
same in the next version.

Pierre-Yves

-----Message d'origine-----
De : A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]De la part de
Jayakumar Mani
Envoy� : lundi 30 avril 2001 11:27
� : [EMAIL PROTECTED]
Objet : Re: file streams in jsp


<%
String sAttr =
config.getServletContext().getRealPath("/") +
"snew.txt";
System.out.println(config.getServletContext().getRealPath("/"));
FileOutputStream outFile = new
FileOutputStream(sAttr,false);
%>
ya refreshing

it is not creating a file in bin directory or in jsp
folder also.
regards
jayakumar

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to