This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Relative Context path issue in struts application

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have 2 projects -

1. ProjecttContent - {context path ---> /hardware/xl/abc/content}
|--------------WebContent
|-----------ODSFileContent
|---------------- content.xml


and ProjectWeb - {context path ---> /hardware/xl/abc}
|-------------- JavaSource
| -------------- package com.xl.abc.data
| ---------- ContentData.java


Now, in ContentData.java i need to get content.xml file to do further operation which is in ProjectContent project.

In ContentData.java ------

I am getting contextpath from request. which returns /hardware/xl/abc since this java file is in ProjectWeb.

As content.xml is in ProjectContent, so appended /content to context path which is returned from request in ContentData.

i.e. request.getContextPath(); returns /hardware/xl/abc

BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(request.getContextPath()+"/content.xml"));

[3/30/11 21:53:06:328 IST] 0000003e SystemErrR java.io.FileNotFoundException: \hardware\xl\abc\content\content.xml (The handle is invalid.)
[3/30/11 21:53:06:343 IST] 0000003e SystemErrR at java.io.FileInputStream.open(Native Method)
[3/30/11 21:53:06:343 IST] 0000003e SystemErrR at java.io.FileInputStream.<init>(FileInputStream.java:129)

Please let me know how to get access to content.xml which is in ProjectContent from ContentData.java in ProjectWeb

Thanks,
Chinnu
 
reply
    Bookmark Topic Watch Topic
  • New Topic