GeeCON Prague 2014*
The moose likes JSP and the fly likes Regarding reading a file in a jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Regarding reading a file in a jsp" Watch "Regarding reading a file in a jsp" New topic
Author

Regarding reading a file in a jsp

yekkala krishna
Ranch Hand

Joined: Mar 04, 2007
Posts: 105
Hi,

i am able to readthe data in a file(which contains some list of devices) through the following code.
But i need to show this data in a dropdown list after clicking a button in a HTML page.
How can i do that?



Thanks for your suggestion.

regards,
rama krishna.y
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3112
    
  42

Use a java class (not a JSP) to access the File, and store all the items you need to show up in a List or an array. Set that list/array as a request-score attribute when dispatching to the JSP. In your JSP, you can use JSTL for:each tag to iterate over that list/array and display each element as an item in your drop down list.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
yekkala krishna
Ranch Hand

Joined: Mar 04, 2007
Posts: 105
Hi Devaka,

Thanks for your suggestion.
Now i am able to see the list in dropdown list in html.

regards,
rama krishna.y
yekkala krishna
Ranch Hand

Joined: Mar 04, 2007
Posts: 105
Hi Devaka,

As we already discuss regarding loading of a file into a dropdown list.
Now in my application i need to load a file according to some option displayed in the dropdown list (contract list). and by clicking some button besides it.
Actually i am extracting contract name and filename from xml using DOM parser and doing viceversa.





regards,
rama krishna.y
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3112
    
  42

I'm not sure if I understand your requirement and the question. Is that viewMapTool.html a static html file? Also I can see a submit button outside your form - was that intentional?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding reading a file in a jsp