Solved

include variables in JSP forward.

Posted on 2003-11-12
10
1,992 Views
Last Modified: 2013-11-18

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
0
Comment
Question by:rarunk
  • 4
  • 4
  • 2
10 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 9731018
<jsp:forward page="/Reports/"+monfname+"/"+time +"/index.html" />

And Reports will have to be inside your webapps folder
0
 

Author Comment

by:rarunk
ID: 9731138
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
 
LVL 35

Expert Comment

by:TimYates
ID: 9731161
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 19

Expert Comment

by:cheekycj
ID: 9732216
do you have to do a forward?  Can you include the file by reading it in using java.io.File API.

CJ
0
 

Author Comment

by:rarunk
ID: 9737161
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
 
LVL 35

Expert Comment

by:TimYates
ID: 9738336
Do it like cheekycj suggested...

Use a FileReader to read the file, and write it to the out stream
0
 

Author Comment

by:rarunk
ID: 9739626
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
 
LVL 35

Accepted Solution

by:
TimYates earned 35 total points
ID: 9740123
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
 
LVL 19

Expert Comment

by:cheekycj
ID: 9740146
What TimYates suggested is correct, I thought you wanted something programmatically but I do not believe that is possible.

CJ
0
 

Author Comment

by:rarunk
ID: 9745190

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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question