wood burning stoves*
The moose likes Other Java Products and Servers and the fly likes How to specify relative path in servlet. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "How to specify relative path in servlet." Watch "How to specify relative path in servlet." New topic
Author

How to specify relative path in servlet.

Bennet Xavier
Ranch Hand

Joined: Jun 19, 2008
Posts: 162
Hi All,

i need to specify the relative path of the *.jasper file in a servlet which is in MY_WEB_APPLICATION/WEB_INF/classes/com/lt/voms/report/Servlet.classes

the jasper file is in MY_WEB_APPLICATION/jrxmls/*.jasper

How will i use this *.jasper file in my servlet. Some one please help me.

servlet is getting called and i am getting FileNotFoundException.

Thanks In Advance,

Bennet Xavier. X
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
Hi,

You can do this by adding this in your web.xml file.

//web.xml amendments



Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
Bennet Xavier
Ranch Hand

Joined: Jun 19, 2008
Posts: 162
Hi ujjwal soni,

Please understand my problem.

i need to specify the path of the jasper file in the method as a argument, that method will create a report for me.

Now, how should i mention the path of that file in the method.

i dont think its possible in the way you have specified, if it is possible how will i mention the path in method.

do reply.

Thanks In Advance
Bennet Xavier. X
Ryan Beckett
Ranch Hand

Joined: Feb 22, 2009
Posts: 192
- returns the virtual path to your resource
Bennet Xavier
Ranch Hand

Joined: Jun 19, 2008
Posts: 162
Hi Ryan Beckett,

if i am developing the application in windows and deploying in unix environment, will this not make any problem.

Bennet Xavier. X
Mohamed Inayath
Ranch Hand

Joined: Nov 22, 2004
Posts: 124
Give the path with forward slash.
It will work on both Windows and Unix.
Bennet Xavier
Ranch Hand

Joined: Jun 19, 2008
Posts: 162
Hi All,

Thank you very much.
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



Multiple post http://www.coderanch.com/t/440997/Web-Component-Certification-SCWCD/certification/servlet-use-file-which-kept

Please do not cross post and waste our time.
 
 
subject: How to specify relative path in servlet.
 
Similar Threads
Specifying relative path
webapp can't find static content
Relative paths
Setting image path
Relative path in JSP for Servlets