FileInputStream fs = new FileInputStream("/opt/Abhishek/software/tomcat/webapps/AMS/listpass");
DataInputStream in1 = new DataInputStream(fs);
while (in1.available() !=0)
String str1=in1.readLine();
StringTokenizer st1 = new StringTokenizer(str1);
String node=st1.nextToken();
if (node.equals(sports[i]))
String pass=st1.nextToken();
out.println ("<b>"+sports[i]+" <b>");
out.println("**Your Required Password**");

Hi ,

I have a text file (named listpass in the above code) inside tomcat-webapps folder containing a node name and its password.You could see the path of the text file at the starting line of the code.The Scene behind the program is once the particular node is clicked the password is retreived for the user against the particular node.What i would need is to change the password in the text file once it is retreived. So i would need to find the password that is retreived recently and change that one with a randomnly generated new password in the text file.

So can i do this?Is it possible to search for the string in the text file and replace that with a new one using JSP.For your note i am running all my HTML amd JSP inside the same folder where i have the text file in which the string has to be replaced .

Could anyone give your comments on this please?

6 Years
Discussion Span
Last Post by peter_budo

You do not want to do this sort of stuff in JSP. Use JSP to give you handle on the file, pass it to servelt that will read file with input stream, process it and display what ever you need on JSP page.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.