Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8731127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:09:38+00:00 2026-06-13T09:09:38+00:00

I m working on school project and I need to display academic year,section and

  • 0

I m working on school project and I need to display academic year,section and medium dynamically from database in jsp file in drop down format. I am fetching the database values from java class and trying call tat java method in jsp to display those values but I am not getting nething der and i dnt want write query in jsp file.. please help me guyz m trying from last 3 days…
my java class

public class EmpBean {
    public java.util.List dataList(){
         ArrayList list=new ArrayList();
         try {
             Class.forName("driver");
             Connection con = DriverManager.getConnection("url", "user", "pwd");
             Statement st = con.createStatement();
             System.out.println("hiiiii");
             ResultSet rs = st.executeQuery("select * from employee");

             while(rs.next()){
                 list.add(rs.getString("name"));
                 list.add(rs.getString("address"));
                 list.add(rs.getString("contactNo"));
                 list.add(rs.getString("email"));
             }

             System.out.println(rs.getString("contactNo"));
         }

         catch(Exception e){}

         return   list;
     }
 }

and my jsp file:

<%@page language="java" import="java.util.*" %>
<html>
    <body> 
        <table border="1" width="303">
            <tr>
                <td width="119"><b>Name</b></td>
            </tr>

           <%Iterator itr;%>
           <%
                EmpBean p = new EmpBean();
                List list= (List) p.dataList(); 
           %>

                for (itr=list.iterator(); itr.hasNext(); ) {
           %>
           <tr>
               <select name="" id="" style="width: 150px;"">
                   <option value="-1"><%=itr.next()%></option>
               </select>
           </tr>
           <%
               }
           %>
        </table>
    </body>
</html>

Edit 1:

Error message:

> The server encountered an internal error () that prevented it from
> fulfilling this request. exception org.apache.jasper.JasperException:
> An exception occurred processing JSP page
> /Administrative/collectFees.jsp at line 93 90: <td colspan="4"><div
> id="fndiv"> 91: <%Iterator itr;%> 92: <% List data=
> (List)request.getAttribute("data"); 93: for (itr=data.iterator();
> itr.hasNext(); ){ 94: %> 95: <select name="year1" id="yr1"
> style="width: 150px;" onclick="showDetails()"> 96: <option
> value="-1">><%=itr.next()%></option> root cause
> java.lang.NullPointerException
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:09:39+00:00Added an answer on June 13, 2026 at 9:09 am

    Try

    <%
    java.util.List list = new EmpBean().dataList();
    %>
    

    To Itterate you can use

    <select>
    <%for(String txt : new EmpBean().dataList()){%>
        <option><%=txt%></option>
    <%}%>
    </select>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For my school project, I am working on a database management application. It is
I'm working on a project for school and I need to track a user
I'm working on a project from school, and we were given a .o and
Working on a school project, the program is supposed to read from a text
Hey all. I'm working on a project for school where I need to pass
I am working on a school project, where I need to develop a hypothesis
I am working on a school project to build a pseudo terminal and file
I'm working on a project for school and need to sort some data. I've
I'm working on a school project which need to be done in Visual Basic.
I am working a school project to implement a Huffman code on text. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.