Monday, May 3, 2010

Access file using JSP & Servlets

Given source code used for accessing file from server using

Servlets


String path = getServletContext( ).getRealPath ("xyz.xml" ) ;
System.out.println ( path ) ;
File file = new File ( path ) ;

JSP
String path = application.getRealPath ("xyz.xml" ) ;
System.out.println ( path ) ;
File file = new File ( path ) ;

In above jsp code, "application" is jsp implicit object.



No comments:

Post a Comment