• Post Reply Bookmark Topic Watch Topic
  • New Topic

dynamic file path and dynamic string search  RSS feed

 
Rajita Stambhampelli
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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
 
Swastik Dey
Rancher
Posts: 1776
13
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • 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
  • 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
Rancher
Posts: 1776
13
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • 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
  • 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
Rancher
Posts: 1776
13
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • 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
  • 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
Rancher
Posts: 1776
13
Android Eclipse IDE Java Java ME
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajitha,

By file name what I meant to say is file name with complete path.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!