• Post Reply Bookmark Topic Watch Topic
  • New Topic

File Not Found Path Problem in JSP  RSS feed

 
Harsh K Garg
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

When i Specified the File Path Location in FileInputStreamClass of Java ,it worked in J2SE but not worked in JSP.I placed the .xml file in Project Directory Structure .I want to retrieve it from the Project Directory Structure of the Project ,it works out side the Project Directory Structure i.e from the Physical path.(C:\airLineShedule.xml)

Syntax i am using for J2SE
FileInputStream fstream = new FileInputStream("airLineShedule.xml");// Work in J2SE
Syntax i am using for JSP
FileInputStream fstream = new FileInputStream("airLineShedule.xml);// not work in JSP

Error: airLineShedule.xml (The system cannot find the file specified).

please Help me.
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use context.getRealPath() to get the real path to a file, and use that path for further IO operations.

Note, It's a bad idea to write IO code in jsp.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!