Navigate/Browse button in a webpage - java

I am workign on a webpage and in that I am querying a DB and getting filepath. I am able to dispaly that path from DB on my page. Now as an enhancement I wanted to add a 'Open' button next to the path being displayed. As the file would be .xml or .xsd so we can use the new window/tab of browser to open the same.
I am aware of html codes used to upload a file but don't know the code to open a file.
I tried playing with <input type=file> but no luck.
So can anyone help me in this.Any small pointer will be helpful.
I am not using Swings so no point of trying JFileChooser

A file input is for people to upload files.
If you want to let people view files that are on the server, just use a normal link.

Related

Is there anyway I can open a PDF from UI made from Angular/JS in Acrobat from one button click

I'm currently implementing an Angular/java webpage to work with different forms for the users.
right now if the users want to edit the pdf, the only way is to download the PDF and go to the downloads folder and open it in Adobe acrobat. Which is not an optimal solution.
Is there any way I can create a button in HTML/Angular webpage that can automate this process to open the PDF in Adobe acrobat? instead of downloading and going to download folder and open it from there?
I tried to use ngx-extended-pdf-viewer to edit the pdf in the browser. But the user needs to highlight, stamp, and email features that are in Acrobat. Does anyone have a solution for this?
thanks
You can display the pdf file in new tab by the line:
window.open(fileUrl, '_blank');
The fileUrl is a variable that contains the file path. You can fetch it after the download is complete.

How to Show Word Document File in Browser instead of downloading Spring MVC?

HI everyone i am doing file handling in my spring MVC Application, i need to display Word file (.doc, .docx) file in my browser instead of downloading..
i am using this code for displaying file in browser,..
response.setHeader("Content-Disposition", "inline; filename=\"%s\"",
downloadFile.getName()");
with this code PDF, IMAGE File, and TXT Files are showing in browser but not word file,
can you please help me how to do this ? i have go through different solutions in stackoverflow and google but i cannot find any thing.
PS: i don't want google docs for displaying word file.
This is entirely up to the browser, most of which don't have built-in support for Word documents. You've already given it the hint, and it will decide how (or even whether) it can handle it.
The only other approach would be to use an inline JavaScript-based viewer, similar to the one that Google Docs does use, but that would change the nature of the response from "here is a file" to "here is a Web application that I'll preload with content".

Java File Doesn't Load in Joomla Site

I am a total newbie in webdesign and I have created a site using the Joomla CMS. However, on a particular page within the site I am trying to launch an interactive calculator that uses java via .class files which are called by an .html file. I used the embedding tag:
<embed src="images/Calculator/classes/examples/PayeCalc.html"
type="application/x-java-applet"
width="1108" height="407">
Nothing shows up on the page however, when I preview it. What am I doing wrong? The .class files are saved in the folder that the .html file is located. Isn't it supposed to call up the files as needed? Why is the page just blank? Can anyone help this newbie to resolve this issue?
Thanks in advance.
Check if your text editor removes the embed tag.
It can happen from the joomla text filters or from the text editor.
Try using JCE text editor and follow the steps described here
Also if you use RSFirewall check this out
Good luck

creating a link to pdf files in netbeans

I am working on a project in netbeans, and right now I want to embed links to various pdf files so that when that link is clicked, the program will call up the appropriate pdf in it or somewhere in the hard disk and open it with the pdf viewer.
I came across a 'clickable label' concept in one article, but I dont know how to do that, all the labels I insert do not link to the source tab when I double click on them.
Can someone please provide an example of how to implement a 'clickable label'?

Java Web application, how to let a client save a generated .txt file?

I have a JSF Web application, and at some point i present the client a big chunk of information, I want to have a save as link, that allows the client to save this information on his computer as a .txt file.
Information on how to achieve this or a good tutorial would be great.
Does this work for you? You probably would need to set the ContentType to "application/octet-stream", otherwise the client's browser will display your text file instead of offering the option to "Save as".
I believe your best bet may be to have that link actually generate an Ajax call to generate the text file and set it as the src attribute of an iframe on the page. That will trigger (I think) the file download box.

Categories