include variables in JSP forward.


hi,
here i'm including two variables
 eg:monfname , time in a forwarded to a  page like below..

<jsp:forward
page="E:\\Reports\\"+monfname+"\\"+time +"\\"+index.html />

here monfname and time are folders and index.html is the file i want to load  thru jsp forward.

I do not have to use Virtual paths.

I try the above code but it shows error missing terms, invalid label etc..

can ayone help me to sort out this..
Thanks..
regards Arunkumar
rarunkAsked:
Who is Participating?
 
TimYatesCommented:
it's in server.xml if you are using tomcat...

I wouldn't recommend this though...  it will mean that your entire drive is visible via the web...
0
 
TimYatesCommented:
<jsp:forward page="/Reports/"+monfname+"/"+time +"/index.html" />

And Reports will have to be inside your webapps folder
0
 
rarunkAuthor Commented:
hi,
In my case the reports will not be in my Webapps.
It might be anywhere in any drive like d:/ or e:/

in that case how to do this?

Arun
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
TimYatesCommented:
I don't think you can without setting up a virtual host thing...

page is a relative URL from the current page, not a fully qualified path to anywhere on your file system :-(
0
 
cheekycjCommented:
do you have to do a forward?  Can you include the file by reading it in using java.io.File API.

CJ
0
 
rarunkAuthor Commented:
Hi,

Actually what i'm getting the value of the
monfname , time  in the jsp page and after getting those i'm creating a path

like ..E:\Reports\monfname\time\index.html ..

The pgae i want to display is like

 E:\Reports\20032012\121314\index.html ...

As i have the value for monfname and time..it should be exactly as above..
Now i want  to show the above html page...
How to do it? I think i have to do it thru <Jsp:forward>
If i can show it in any other way...
Your supports are welcome...
regards Arun.



0
 
TimYatesCommented:
Do it like cheekycj suggested...

Use a FileReader to read the file, and write it to the out stream
0
 
rarunkAuthor Commented:
Hi,

No i don't want to use  filereader.
The issue is because of the root path.

So can any one suggest how to change the document root path .
Is it possible?                  
 and get the points for this question.

regards
Arun


0
 
cheekycjCommented:
What TimYates suggested is correct, I thought you wanted something programmatically but I do not believe that is possible.

CJ
0
 
rarunkAuthor Commented:

Hi CJ & TimYates..

Thanks for your Suggesstion. I want to share the Points to both of you.
But the application accept only one as a Accept Answer.
Anyway Thanks to both of you for your kind support.

regards
Arun
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.