• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

dynamic file path and dynamic string search

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello friends

I would like to take file path from the user dynamically from jsp file and i would like search the string in that file (search string also be dynamically given).
i know we can use scanner class for string search, but exactly dont know how to start the program and how to retrive the file path n string dynamically.

please help me in this.

Thank you in advance
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the user gives the file path and search string in a jsp page, I believe it will be processed in sever, right? In that case the user needs to know the path of the file located in server. As far as retrieving the details are concerned, you should have a servlet, this should be invoked when user submits the jsp page, and in your servlet you can use getParameter method of request object to retrieve the details like file name and search string.
 
Rajita Stambhampelli
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thank you for the reply

I meant
I have 500 different logfiles and text files , i have to select one file(each time different)from them to search a particular string(this is also dynamic, every time varies) according to the file. and print the results that on which line number i found that string. am confused in how to access file path dynamically through JSP or Html and read line by line and search for the string ? dont know how to start.
please suggest me to start

Thank you in advance
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rajitha,

Could you please clarify bit more. By dynamic file name, what exactly do you mean? Is the file name/path entered by the user or is the file name selected based on some condition.
 
Rajita Stambhampelli
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Swastik Dey wrote:Rajitha,

Could you please clarify bit more. By dynamic file name, what exactly do you mean? Is the file name/path entered by the user or is the file name selected based on some condition.



i would like to give the path of the file which is in same machine.
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, so as per my understanding you should have a page from where you can enter the details, and the submit action should be mapped to a servlet

jsp/html code
-------------


servlet code
--------------
 
Rajita Stambhampelli
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks alot Swastik .
Wil this work for path of the files too ??

Anyways thank you
I will try and let you know the result. i hope it works.

 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rajitha,

By file name what I meant to say is file name with complete path.
reply
    Bookmark Topic Watch Topic
  • New Topic