How to search for file in jsp page

i need help on how to search for a file in a folder where there is a lot of subfolder.like how u search in a document in windows. i need a complete codes in jsp page.
thank you in advance.
Message was edited by:
n_dilah

no i need to do a search engine in jsp page which is the j2ee.
i type smth than tat file from any folder will appear the same way when u need to search your file in a document in windows.
well can u nice people tell me where i can get the codes bcos i stinks when it come to programming.
thank you very very very much.

Similar Messages

  • How to search for files using wildcards * and ?.

    Hi All,
    I've been searching the forum for a couple of hours now and have been unable to find a good example of how to search a directory (Windows OS) for a file using wildcards * and/or ?. Does anyone out there have a good example that they can share with me?
    Thanks

    Hi All,
    First of all I want to thank everyone for taking the time to respond to my question. All of your responses where greatly appreciated.
    I took the example code that was posted by rkconner, thanks rkconner, and modified it to allow me to search for files in a directory that contain * and/or ?. Yes, I said and/or! Meaning that you can use them both in the same file name, example: r??d*.t* would find readme.txt.
    I've posed my complete and thoroughly document code below. I hope it is very helpful to other as I have searched many forums and spent many hours today trying to resolve this problem.
    Enjoy
    * File Name: WildcardSearch.java
    * Date: Jan 9, 2004
    * This class will search all files in a directory using the
    * asterisk (*) and/or question mark (?) as wildcards which may be
    * used together in the same file name.  A File [] is returned containing
    * an array of all files found that match the wildcard specifications.
    * Command line example:
    * c:\>java WildcardSearch c:\windows s??t*.ini
    * New sWild: s.{1}.{1}t.*.ini
    * system.ini
    * Command line break down: Java Program = java WildcardSearch
    *                          Search Directory (arg[0]) = C:\Windows
    *                          Files To Search (arg[1]) = s??t*.ini
    * Note:  Some commands will not work from the command line for arg[1]
    *        such as *.*, however, this will work if you if it is passed
    *        within Java (hard coded)
    * @author kmportner
    import java.io.File;
    import java.io.FilenameFilter;
    public class WildcardSearch
         private static String sWild = "";
          * @param args - arg[0] = directory to search, arg[1] = wildcard name
         public static void main(String[] args)
              String sExtDir = args[0]; // directory to search
              sWild = args[1];   // wild card to use - example: s??t*.ini
              sWild = replaceWildcards(sWild);
              System.out.println("New sWild: " + sWild);
              File fileDir = new File(sExtDir);
              File[] arrFile = fileDir.listFiles(new FilenameFilter()
                   public boolean accept(File dir, String name)
                        return (name.toLowerCase().matches(sWild));
              for (int i = 0; i < arrFile.length; ++i)
                   System.out.println(arrFile.getName());
         }     // end main
         * Checks for * and ? in the wildcard variable and replaces them correct
         * pattern characters.
         * @param wild - Wildcard name containing * and ?
         * @return - String containing modified wildcard name
         private static String replaceWildcards(String wild)
              StringBuffer buffer = new StringBuffer();
              char [] chars = wild.toCharArray();
              for (int i = 0; i < chars.length; ++i)
                   if (chars[i] == '*')
                        buffer.append(".*");
                   else if (chars[i] == '?')
                        buffer.append(".{1}");
                   else
                        buffer.append(chars[i]);
              return buffer.toString();
         }     // end replaceWildcards method
    }     // end class

  • Please answer. how to search for files

    Hi,
    We need an integration with SAP. They send us files in the format: yyyymmddhhmiss.atv
    For example we receive following files:
    20050503101115.atv
    20050504101115.atv
    20050505101115.atv
    So, we dont know how to search for all files with extensions ".atv" in the directory.
    We are using PLSQL. Is there some way to resolve with UTL_FILE?
    Any other suggestion?

    A possibility:
    In sqlplus, issue a HOST command to list the files to a file:
    ls *.atv &gt; atv_dir.txt
    Then use utl_file to read atv_dir.txt and parse it for the file names.
    You could put the filenames in a pl/sql table and use that as loop control.

  • How to search for file in a directory or subdirectories?

    I need ur help urgently. I'm currently doing a java project in which the program should be able to do file searching.
    For eg. if I key in a.jpg, it should display C:\pictures\a.jpg (a.jpg is stored in a folder called "pictures")
    But the problem is that my program is only able to search in the C drive only.
    If I move the file into a folder in the C drive, my program cannot detect this.
    Can you help me to solve this problem? I'm really looking forward for your reply.
    Thanks. Here are the codes.
    import java.io.*;
    import java.awt.*;
    class FindFile
         public static void main(String args[]) throws IOException
              //reads the user input
              BufferedReader userInput;
              while(true)
                        userInput = new BufferedReader(new InputStreamReader(System.in));
                        String s = userInput.readLine();
                        //quits the system               
                        if(s.equals("/quit"))
                             System.exit(0);
                        //if user does not key in anything, prompt msg appear
                        else if(s.equals(""))
                             System.out.println("Command Syntax: java ListFiles <filename>");
                             System.out.println("<filename> - The full name of a file and extension (i.e., test.txt)");
                        else if(userInput != null)
                             String t = "c:";
                             File f = new File(t);
                             String[] files = f.list();
                             char[] qwet;
                             boolean test = false;
                             //check for the file name and compare with the user input
                             for (int i = 0; i < files.length; i++)
                                  if(files.equals(s))
                                       System.out.println("");
                                       System.out.println("File Found");
                                       System.out.print("The File Found at This Path: ");
                                       //display the path
                                       System.out.print(f.getAbsolutePath());
                                       System.out.println(files[i]);
                                       test = true;
                                       break;
                             //if file does not exist
                             if(test == false)
                                  System.out.println("File Not Found");

    well, i think the best solution would be make a recursive search through the directory tree. I don't know if you are familiar to this, but the functions that searches for the file would look like this:
    public String searchFile(String name) {
      File[] roots = File.listRoots();   // List all file roots (in windows the different units, c:, d:, etc.)
      for (int i = 0 ; i < roots.length() ; i++) {
        String aux = recursiveSearch(roots, name);
    if (aux != null) {   // If the "recursiveSearch" returns something different than null is that the file is founded, so we return the path.
    return aux;
    return null; // If we get there nothing has been found
    private String recursiveSearch(File f, String name) {   // f is the directory to search for the file with name "name"
    File[] childs = f.listFiles();
    for (int i = 0 ;i < childs.length ; i++) {
    if (childs[i].isDirectory()) {  // If that is a directory we search inside
    String aux = recursiveSearch(childs[i], name);
    if (aux != null) {   // We have found it inside this directory
    return aux;
    } else {  // Is a regular file
    if (name.compareTo(childs[i].getName()) == 0) {   // If the file is what we want we return his path
    return childs[i].getCanonicalPath();
    // If we get here is because the file is not inside the directory or any subdirectory on it
    return null;
    You should just call the function searchFile(name) with the name of the file you want to search. If it finds one with this name it will return his absolute path, and if he doesn't the desired file he will return null.
    If you don't understand anything just ask.
    (Note: i have not tested this code, so can be some mistakes, but it think it is almost correct. mmmhh don't now why, but [ & ] appear in my code as < & >. Just replace them.).
    Hope that helps.
    Zerjio

  • How to search for file within compressed file

    I hope i can explain this correctly, I apologize in advance.
    What is the command to search for a file that may/may not exist within another compressed file?
    Situation is that I have a cron job that compresses the files in a folder on a scheduled date. I now need to search for a file that may exists in one of the several compressed files, which was a result of the cron job.
    Thanks in advance

    There's an open source utility called zgrep. You can probably get it from http://www.sunfreeware.com/ .
    HTH,
    Roger S.

  • How to search for folders using jsp ( or any other way)?

    Hey All,
    It's my first time writing here and i hope i can get some help ... i have created a payroll system using java and jsp techniques and mysql as the database, i want to create a backup page that will let the use to choose the destination folder for the back up, the backup is basically a mysqldump command that will get the destination folder as an argument and create the sql file there. the problem is i couldn't find anyway to let the user browse his local machine and choose the folder , which in returns return the folder path to be used in mysqldump....
    I know that html have <input type=file> but it's used for selecting file not folder...
    can someone come up with a solution for me coz it's urgent and i have to finish the project by the end of this week.,.
    peace!

    Also you can use an OUTPUT clause ( need to modify your DML operations)
    create table itest ( i int identity not null primary key, j int not null unique )
    create table #new ( i int not null, j int not null)
    insert into itest (j)
    output inserted.i, inserted.j into #new
    select o.object_id from sys.objects as o
    select * from #new
    drop table #new, itest;
    go
    The example below shows code that uses OUTPUT clause in UPDATE and DELETE statements to insert rows into an audit table.
    create table t ( i int not null );
    create table t_audit ( old_i int not null, new_i int null );
    insert into t (i) values( 1 );
    insert into t (i) values( 2 );
    update t
       set i  = i + 1
    output deleted.i, inserted.i into t_audit
     where i = 1;
    delete from t
    output deleted.i, NULL into t_audit
     where i = 2;
    select * from t;
    select * from t_audit;
    drop table t, t_audit;
    go
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to download Excel file in JSP Page

    Actually I have a page
    Where I am uploading the files to server and it is listing the files which are all uploaded to the server.
    If I try to click the file which is uploaded it has to download to the local system.
    DOC, TXT, PDF, PPT. These file formats are try to download to local. But Excel file, opening the file content only not downloading to local.
    Any solution

    Hi Bangalore:
    As my experience,there may be some symbol such as "\r\n" was added in the content of the Excel file you want to download. this is no porblems to text format file, but to binary format file, such file can not be open. So I suggest you check-up the content of the file befor it was writed to the client, remove unwanted symbol, it should be word!
    I'm a newer to the here , and my english is poor. I thirst for intercommunion, I'm sorry for the syntax error in my reply.

  • How to search for files everywhere?

    When I use Apple-F to find files, apparently only some folders are searched, even when I have "This Mac" selected. For example, I cannot seem to find anything in ~/Library. Can I force it to search all folders that I have permission to view? Thanks for any help!

    to search those folders you need to include system files in your search.
    After you enter command+f to bring up a search window, click on "Kind" and scroll to "other". You'll get a popup window will all possible search parameters. Choose "system files" and set it to "include". To see even more items, select "Spotlight items" and include those.

  • How can i render a dynamic html file in jsp page

    Hi everybody,
    i am trying to render a dynamic html file in jsp page with the result of querying a database.
    The response of the query is a xml document. And i have a stylesheet to transfer it to html.
    How can i render the html in a jsp file?

    I am using below code for HTML files
    private var appFile:String="index.html";
    if (StageWebView.isSupported)
                        currentState = "normal";
                        webView.stage = stage;
                        webView.viewPort = new Rectangle( 10, 130, (stage.stageWidth)-20, 750 );
                        var fPath:String = new File(new File("app:/assets/html/aboutus/"+ appFile).nativePath).url; 
                        webView.loadURL(fPath);
                        addEventListener(ViewNavigatorEvent.REMOVING,onRemove);
                    else {
                        currentState = "unsupported";
                        lblSupport.text = "StageWebView feature not supported";
    above code is working fine for me.

  • How do I exclude directories from Finder search results? I'm trying to find the biggest FILES on my computer and it keeps showing me "Macintosh HD" as the biggest, how can I search for files of type "NOT folder/directory"?

    Basically I've lost 10GB of free space over the last few weeks so my plan was to search for files modified in the last 2 weeks in order to figure out which ones are big and where that space went.
    So I open finder, go to "File > Find", and enter a search:
    Modified > In the last 2 weeks
    All fine so far.
    Problem is, it's showing whole directories as results. Which essentially means that when I order the list by size, Macintosh HD is at the top, followed by "Users", then "Applications", then one of my bigger movie files, then "Library", etc.
    How can I do a search which will ignore folders? I want individual files. Knowing that Macintosh HD is the biggest item on my computer and was modified in the last 2 weeks is utterly useless to me.
    Older versions of Finder in OS 9 had a feature where you could search for "files, whose type "IS NOT" folder", but OS X doesn't seem to have such a feature.
    Can anyone help?

    How much free space is on the HD, where has all the space gone?
    OmniDiskSweeper is likely the easiest/best, and is now free...
    http://www.omnigroup.com/applications/omnidisksweeper/download/

  • How to call cystal report8 report file from jsp page

    hi guys
    present i am using cystal report8 already i am having ReportViewer.jar and ReportviewerBean.jar files
    using that please send me sample code how to call that report from jsp page..
    and how to pass the parameters from jsp page to crystalreport8 report file.
    it was very urgent task to me..so please send sample code on above topic..
    or send me crystalreport8 API
    thanks
    regards

    Hi,
    I also want to work on crystal report but i dont have the ReportViewerBean.jar and ReportViewer.jar. So, please tell from where will i get those jar files.
    Thanks in advanced.

  • How To Search For a Specific File name?

    Hello Everybody
    How To Search For a File Like NewFile.txt in a Root Like C:\\
    And If The File Is Found Open It And Write In It?

    http://forum.java.sun.com/thread.jspa?threadID=5194090&messageID=9763314

  • Trouble searching for files in Pages

    For some reason, when I go to open a file in Pages '09, some of them will not show up if I type in the file name in the search in the upper right hand corner of the window. I know for 100% certainty I have the file name correct - to make sure it is a search problem and not my memory having issues I would search for a file and while looking at the file name, type it in... and I would get 0 search results. I clicked for it to search by file name. The files it does not seem to be able to recognize are file names with Japanese as part of the file name that were saved using my Mac (MacBook Pro - OS X 10.6.8). Files with Japanese in the file name saved on windows computers and transfered via my flashdrive have no issues being found. I can open the files, so that is not the problem. And, if I scroll through all the files I can find it. The problem is that sometimes I don't remember the full file name - especially which word I put first - so having to scroll through all my files to find the one I want is rather annoying. I would prefer to be able to search for any of my Pages files. Is there anyway to fix this? Or is the Pages search just not made to be compatible with any language other than English? (I am not sure if it is relavant, but if I search for the files via Spotlight, I can find them using the English or Japanese portion of the file name. Even though Finder does not allow me to use the Japanese portion of the file name in a search, the files do show up if I use the English portion of the file name.)
    Any help of why this problem exists and if there is any way to fix would be very much appreciated.

    Hi KJ,
    in the search in the upper right hand corner of the window.
    The Pages window? I can't see a search box.
    Do you mean Spotlight? (The magnifying glass icon?)
    System Preferences > Personal > Spotlight > Search Results.
    Make sure there is a tick next to Documents.
    Spotlight will find file names (partial or complete match) or a word or phrase within files.
    Regards,
    Ian

  • When importing files, my view window to search for files is really small, how do I make it bigger so I can actually search for files?

    When importing files, my view window to search for files is really small, how do I make it bigger so I can actually search for files?

    How big this is depends on the size of your screen. On a 13" it is really small. But you can improve things a bit. Click the green button to make the import window fill the screen.
    Drag the area between the file list and the preview area up or down to increase one or the other:

  • I have a external hard drive connected, Finder will not let me search for files in the external hard drive how do i search in a hard drive

    i have a external hard drive connected, Finder will not let me search for files in the external hard drive how do i search in a hard drive

    What are you using to search? You should be able to search any drive in from the Finder. If you're having trouble, try "EasyFind" from the App Store (free). You can search any volumes with it.
    Clinton

Maybe you are looking for

  • Copy and paste images on iPad air 2

    Can i copy and paste images from safari onto documents that i access through my iPad air? I use this device in university and i found that when i tried to copy an image into a docs app document, the only thing i could paste was the image url. Does an

  • Serial # not able to type letters

    its not possible to type in letters of my serial number to license my product in the adobe application center. i only can  type in the numbers but then 7 characters are missing (the 7 letters). how am i supposed to continue?

  • Mail "disappears" after a period of inactivity

    Since upgrading to Leopard a strange problem is occurring. On returning to iMac after period of inactivity mail appears "open" in dock and menus appear at top of screen. However, the application just won't display anything at all. Only solution is to

  • Counter output error

    Hi all, I wish to output my counter pulse to a waveform graph.  However, I am getting an error: Error -200673 occurred at DAQmx Write (Digital 1D Wfm NChan 1Samp).vi:1 Possible reason(s): Measurements: Multiple samples cannot be written using a singl

  • Internet Explorer interfears with Printing

    After a recent update of Windows Server, all printers stopped working. The culprit was Internet Explorer.  The security zones were updated which stopped the printer drivers from sending data to the printers via TCP.  How can Internet Explorer be remo