• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to display the file path returned by Java code in html/jsp page as a link.

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am new to Javascripting/HTML. My HTML page looks like
<html>
<head>
.....
......
<script>

Some function named rpcCallMuleEcho(){
}

// Display response message data. Please dont worry on how this function is getting called. I have the logic insiderpcCallMuleEcho(). The function rpcEchoResponse will assign a value like C:\Users\SHARMA\MuleStudio\workspace\Test\songs\Translated\File1.txt_05_19_2014_1.04.42.AM to "response"

function rpcEchoResponse(message) {
document.getElementById("response").innerHTML = message.data;
}
</script>
</head>

<body>


<select id="inputFileSelect">
<option value="C:\\Users\\SHARMA\\MuleStudio\\workspace\\Test\\songs\\Input\\File1.txt">File1.txt</option>
<option value="C:\\Users\\SHARMA\\MuleStudio\\workspace\\Test\\songs\\Input\\hello.docx">hello.docx</option>
</select>
<input id="sendButton" class="button" type="submit" name="Go" value="Send" onclick="rpcCallMuleEcho();"/>
<br/>
<br/>
<br/>
<br/>
<legend><b>  Output File Links</b></legend>
<label>Original File</label>
<pre id="inputFileSelect"></pre>
<label>Translated File</label>
<pre id="response"></pre> //prints response C:\Users\SHARMA\MuleStudio\workspace\Test\songs\Translated\File1.txt_05_19_2014_1.04.42.AM
</body>

I want to display response like a link on the click of which we should be able to download the file(C:\Users\SHARMA\MuleStudio\workspace\Test\songs\Translated\File1.txt_05_19_2014_1.04.42.AM). IS it possible in anyway?

Thanks in advance,
Rachael

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to download files, you'll need to reference them by the HTTP protocol, not the file protocol. And the files must be located where the server can access them via an http URL.

Obviously you can't just grant access to any file on your file system. Imagine the nightmarish security implication if you could!
 
No prison can hold Chairface Chippendale. And on a totally different topic ... my stuff:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic