Oddly enough, Iain Emsley has the same problem on another posting on this very same board. He is using a regular expression and the split method of String.
I guess maybe I should explain what I wanna do then someone might be able to tell me if it can even be done in jsp.
I have a jsp form that contains a drop-down list of all the states. When the user chooses a state, I want the capital field in the form to get populated with the chosen state's capital city. I have the state/capital pairs in a text field with a dash as the delimiter.
I am assuming you meant text file above. You can read that into a collection such as a map. The StringTokenizer can be helpful there. Then when a state is selected, you can call a method on the backend that will return the state's capital.
Bosun (SCJP, SCWCD).
So much trouble in the world -- Bob Marley
Be sure not to do this in the JSP itself. In fact, if the text file is not going to change much, load it into a Map in application scope at application startup.