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

  • SEARCH
  • Home
  • 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 6204165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:02:30+00:00 2026-05-24T05:02:30+00:00

I recently started studying JSP and Servlets. I am facing problems forwarding the dataList

  • 0

I recently started studying JSP and Servlets. I am facing problems forwarding the dataList (rows from database) to JSP using requestdispatcher. In fact I have error in my JSP page which I couldn’t figure out. Since I am learning I couldnt find where the error is:

Thank you!

The following is the error I get

org.apache.jasper.JasperException: An exception occurred processing JSP page /dataPage.jsp at line 29

26:         %>
27:         <tr>
28:             <td width="100"><%=itr.next()%></td>
29:             <td width="100"><%=itr.next()%></td>
30:             <td width="100"><%=itr.next()%></td>
31:             <td width="100"><%=itr.next()%></td>
32:         </tr>


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:519)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:428)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    AuthenticationServlet.doPost(AuthenticationServlet.java:60)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

my code in JSP is:

<table border="1" width="400">
        <tr>
            <td width="100"><b>Name</b>
            </td>
            <td width="100"><b>Contact No</b>
            </td>
            <td width="100"><b>SSN</b>
            </td>
            <td width="100"><b>Date of Birth</b>
            </td>
        </tr>

        <%  
            List<String> data = (List<String>)request.getAttribute("data");         
            Iterator<String> itr = data.iterator();
            while (itr.hasNext()) {
        %>
        <tr>
            <td width="100"><%=itr.next()%></td>
            <td width="100"><%=itr.next()%></td>
            <td width="100"><%=itr.next()%></td>
            <td width="100"><%=itr.next()%></td>
        </tr>
        <%
            }
        %>
    </table>

My code in servlets is

List<String> dataList = new ArrayList<String>();

        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();
            conn = DriverManager.getConnection(url);
            conn.createStatement();

            stmt = conn.prepareStatement("SELECT name,password FROM employeeinfo WHERE name=? AND password=?");         
            stmt.setString(1, username);
            stmt.setString(2, password);
            rs = stmt.executeQuery();

            if(rs != null) {
                while(rs.next()) {
                    int i = rs.getRow();
                    if(i == 1) {
                        dataList.add(rs.getString("name"));
                        dataList.add(rs.getString("contactno"));
                        dataList.add(rs.getString("ssn"));
                        dataList.add(rs.getString("dob"));
                    }
                }
            } else {
                out.println("Invalid User !!");
            }

        } catch(Exception e) {
            e.printStackTrace();
        }
        request.setAttribute("data", dataList);
        // Dispatch the request
        RequestDispatcher dispatcher = request.getRequestDispatcher(page);
        if(dispatcher != null) {
            dispatcher.forward(request, response);
        }
  • 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-05-24T05:02:32+00:00Added an answer on May 24, 2026 at 5:02 am

    You are not selecting contactno, dob and ssn in your query.

    Modify your query to say select name, contactno, dob, ssn from employeeinfo WHERE ....

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently started on creating a 'game' using PHP and a mysql database. In
I recently started using LINQ to SQL in my database later for a C#
I recently started work on a personal coding project using C++ and KDevelop. Although
I recently started using Eclipse at work for my Java servlet projects. I've been
We recently started using maven for dependency management. Our team uses eclipse as it's
I recently started using scons to build several small cross-platform projects. One of these
I recently started using Git as my version control system for some Cocoa projects
I recently started using Linux as my primary OS. What are the tools that
I recently started game programming on the iPhone using Cocos2d and Box2d. So here's
I recently started using Emacs for editing. When I edit english-language files (like program

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.