Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

Need to provide a dialog box for the user to select a file in jsp

i have a jsp file [which executes a XSL transformation] and need to provide a dialog box so that the user can select the input xml file on which the xsl transformation can be done. How to do it jsp? And the file which will be selected will be in the server...
0
emsenthil
Asked:
emsenthil
1 Solution
 
Ajay-SinghCommented:
You can follow this to upload the file http://www.devsphere.com/mapping/docs/guide/upload.html
0
 
emsenthilAuthor Commented:
Hi, Thanks for your reply.
But, I need the user to select the file which is in the server itself by providing a navigation box... I don want the user to upload the file.
0
 
rrzCommented:
You could use something like the following code. If you want it in a pop-up, then we could add javascript to do that.
<%@ page import="java.util.*,java.io.*" %>
<html>
<body>
Selected file is ${param.file}
<form>
<%
  File dir = new File(application.getRealPath("/xmlFiles"));
  String[] fileList = dir.list();
  for(int i =0 ; i<fileList.length ; i++){
      out.print("<input type='radio' name='file' value='" + fileList[i] + "'/>" + fileList[i]);
  }
%>
<input type="submit"/>
</form>
</body>
</html>

Open in new window

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.

Join & Write a Comment

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now