This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

calling txt file from jsp  RSS feed

 
Suresh Poosapati
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is some text file with .txt extension with some information like key - value pairs.

sno value

1 apple
2 bat
3 cat


now I will create a jsp page and i will ask user to enter sno .

if anybody enters 1 it has to display apple
if anybody enters 2 it has to display bat and so on.

Can anybody suggest some ways to solve this? thanks in advance


 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like homework to me - how far have you gotten with this problem?

Can you read and parse the text file?

Bill
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William has set you on the correct path. The first step is to create a Java class -- not a JSP -- that reads in the values. This class can then be used from a servlet or Bean to put the data into a usable form for the JSP to consume. A Map perhaps.

If you have trouble with file I/O, there's an I/O forum here where you can get help on that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!