• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How to display the retrive data in select drop down list.

 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Sir/Madam,
The DATA IS SUCCESFULLY RETRIVE FROM data.txt (data.txt contains: Sumanta,Harish,Jiban).Sir my doubt is i want to display the same data in
select drop list.Could you please help me how to write it.

Please look my code mentioned in the below.


<tr>
<td>Subject of Issue  
<select name="selName">
<option value="" selected>---Select the Issue---</option>

<%
try{
String theBR;
String txtValue = "";
File fin=new File("C:/TestData/data.txt");
FileReader fr=new FileReader(fin);
BufferedReader br=new BufferedReader(fr);
theBR=br.readLine();
String[] theSplit=theBR.split(",");
for(int i=0;i<theSplit.length;i++)
out.write(" - "+theSplit[i]);
}catch(Exception Ex){
System.out.println("exception in getting connection"+Ex.getMessage());
}
%>


</select>


Thanks and Regards,
Sumanta Panda
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This looks like a JSP question to me, shifting to the correct forum.
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this one

<tr>
<td>Subject of Issue
<select name="selName">


<%
try{
String theBR;
String txtValue = "";
File fin=new File("C:/TestData/data.txt");
FileReader fr=new FileReader(fin);
BufferedReader br=new BufferedReader(fr);
theBR=br.readLine();
String[] theSplit=theBR.split(",");
for(int i=0;i<theSplit.length;i++)
out.print("<option value=\"" + theSplit[i] +
"\">" + theSplit[i] + "</option>");
out.print("</select>");

}catch(Exception Ex){
System.out.println("exception in getting connection"+Ex.getMessage());
}
%>


</select>
 
reply
    Bookmark Topic Watch Topic
  • New Topic