How to set default location in view tag

I create a project in j2ee.I use the Browse button. I need to get images / files from a folder inside my project folder everytime.I want to set the project folder name as the default location for my view button. How to do it?

am using the following code on the jsp page:

and calling the value in the servlet:

String image = (String) request.getParameter ("img");

while browsing, the entire path is displayed, but only the image name is passed as value to sevlet.How to get the entire path? or how to set the project folder as the default location while browsing?

+1


source to share


2 answers


If this is a rendering of the standard

<input type="file".../>

      

Then you don't have a default control .



Using flash increases control over you (preset files, single / multiple file selection, etc.)

I'm not sure if Java applets have more access / options, hopefully someone can advise.

PS. for a standard input tag, the browser will remember the last location you used, so you only need to navigate once if you download multiple files from the same directory.

+1


source


I actually solved this problem with an interesting trick. Here's how ...

Create an external vbscript include file

called vbshelper.inc

which contains the following code:

function stuffKeys(x)
     Set wshShell = CreateObject("WScript.Shell")
    wshShell.Sendkeys(x)
end function

      


Inside the HTML header, put the following line as the first element < Script

> ...



< Script type="text/VBScript src="vbshelper.inc">

later, in your HTML, create a button like this ...

< input type="File" id="srcFile" onchange="go_do_something()" onclick="stuffkeys(' C:\Temp\*.txt~')">

Notice the space before the C in ' C:\Temp*.txt~'

and the tilde ~

after the .txt.

+1


source







All Articles