I want to get only the filename from the entire path in a file dialog in JSP. Right now I am using type "file" in input tag.

any help will be appreciated.


There is not jsp dialog user interface for file selection. It's a input type file html tag.
If you want to get filename only in your server side (java) code then use,

File s=new File("c:\\aa\\b.txt");

Use following javascript code to get filename.

<script type="text/javascript">
   function doit() {
    var v=form1.file.value; 
<form method="post" name="form1">
<input type="file" name="file"/>
  <input type="button" value="Test" onclick="doit()"/>