7 Replies - 1228 Views - Last Post: 25 June 2012 - 07:58 AM

#1 RajithaArun  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 24-June 12

accepting the dynamic filepath from the user and search in the file

Posted 24 June 2012 - 11:41 PM

hello friends,

i would like to take the path of the file from user using JSP page and i would like to search a string in that particular file. please help me on this. how to start. to search the string in file i can use the scanner class but how can get the dynamic path name to jsp and then to my java program(servlet).
Thanks in advance :)

Is This A Good Question/Topic? 0
  • +

Replies To: accepting the dynamic filepath from the user and search in the file

#2 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2831
  • View blog
  • Posts: 11,993
  • Joined: 20-September 08

Re: accepting the dynamic filepath from the user and search in the file

Posted 25 June 2012 - 02:35 AM

You do realise that you can only search files that are on the same machine as the web server?
Was This Post Helpful? 0
  • +
  • -

#3 RajithaArun  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 24-June 12

Re: accepting the dynamic filepath from the user and search in the file

Posted 25 June 2012 - 03:27 AM

View Postg00se, on 25 June 2012 - 02:35 AM, said:

You do realise that you can only search files that are on the same machine as the web server?



Thank you for reply....

Ya, i meant file should not be static. Because i have 500 different files to search in same machine.
so every time i have to select the file, in which i would like to do search for some specific string.
Hope am clear. and i am unable to sort this problem. can i use jsp to retrive different file names fro the user side and
then send that path to java program (servlet) and then read the file and search for string (string is also a dynamic)?
Please need your help and suggestions.

Thank you in advance
Was This Post Helpful? 0
  • +
  • -

#4 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2831
  • View blog
  • Posts: 11,993
  • Joined: 20-September 08

Re: accepting the dynamic filepath from the user and search in the file

Posted 25 June 2012 - 03:59 AM

Quote

can i use jsp to retrive different file names fro the user side and
then send that path to java program (servlet) and then read the file and search for string (string is also a dynamic)?


Yes, that would be possible. Another option would be to use a signed applet to search the client side. In a sense, you'd need a signed applet anyway to execute a gui-based file browser for the client side (so the user could select a file), so you might as well do it that way anyway.
Was This Post Helpful? 0
  • +
  • -

#5 RajithaArun  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 24-June 12

Re: accepting the dynamic filepath from the user and search in the file

Posted 25 June 2012 - 04:04 AM

Yes, that would be possible. Another option would be to use a signed applet to search the client side. In a sense, you'd need a signed applet anyway to execute a gui-based file browser for the client side (so the user could select a file), so you might as well do it that way anyway.
[/quote]

Thanks alot for quick reply

am not sure about applets(coz i dnt know much about them), please can you suggest any other method. to call paths dynamically to the jsp page n retrieve them in servlet to read and search.

Thank you in advance
Was This Post Helpful? 0
  • +
  • -

#6 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2831
  • View blog
  • Posts: 11,993
  • Joined: 20-September 08

Re: accepting the dynamic filepath from the user and search in the file

Posted 25 June 2012 - 04:09 AM

The only other way would be to use a web form with an input of type="file" and upload the whole file to the server for searching

In a sense, you'd need a signed applet anyway to execute a gui-based file browser for the client side (so the user could select a file)

Ignore that last - that's only the case for multiple selection (which you probably don't need)

This post has been edited by g00se: 25 June 2012 - 04:10 AM

Was This Post Helpful? 0
  • +
  • -

#7 RajithaArun  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 24-June 12

Re: accepting the dynamic filepath from the user and search in the file

Posted 25 June 2012 - 04:14 AM

Thank you :)

I will try. and i will let you know the result.

hope it will work.
Was This Post Helpful? 0
  • +
  • -

#8 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10806
  • View blog
  • Posts: 40,279
  • Joined: 27-December 08

Re: accepting the dynamic filepath from the user and search in the file

Posted 25 June 2012 - 07:58 AM

Moved to Java EE.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1