dcsimg
checking user name and password(input) against the listen in a file.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jay_Desai
Posted On:   Thursday, December 6, 2001 11:24 AM

I am reading the user name and password.
I read the first user name and password from a file(text file) and checked it with input from the user and this works fine.
But I dont know how to make a loop that continuously reads and checks the user name and password from the list in the txt file. Do i check to see if nextToken is true or what? Or do I make it read until it reaches EOF, and if so how do I do that.

thanks.

Re: checking user name and password(input) against the listen in a file.

Posted By:   Thomas_Rosenbaum  
Posted On:   Thursday, December 6, 2001 01:16 PM

Jay -

I'm a little unclear about what exactly the problem is ... however, from what I can gather:

Obviously you need to use an InputStream to read in the file. Then you could use a default StringTokenizer to grab the values, (provided that each set has some sort of seperating character) throw the name/value pairs into a HashMap, use the containsKey() method to look for the submitted name value, and the get() method to check the password.

Of course there are a ton of ways to parse text, but this is a simple way ... does this speak to your question?

~ Thomas

About | Sitemap | Contact