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 7997059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:52:31+00:00 2026-06-04T14:52:31+00:00

I have a problem with a jsp page (I’m a novice). In a jsp

  • 0

I have a problem with a jsp page (I’m a novice).
In a jsp page, I wrote a table that is read from a database.
I write here the code of the page:

<%@page import="java.sql.SQLException"%>
<%@page import="java.lang.String"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.util.Date "%>
<%@page import="jord.ConnectionManager "%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<% 
    String sql= "select numelencotrasm,dtelencotrasm \n"+
                "from fimand \n"+
                "where eser=2012 \n"+
                "group by numelencotrasm,dtelencotrasm \n"+
                "order by numelencotrasm";
    ConnectionManager manager = new ConnectionManager();
    Connection conn = null;
    Statement stmt = null;
    ResultSet rs = null;
    try{
        conn = manager.getConnection();
        stmt = conn.createStatement();
        rs = stmt.executeQuery(sql);
    }catch(SQLException ex){
        rs.close();
        conn.close();
        rs=null;
        conn=null;
        response.sendRedirect("../index.jsp");
    }
%>
<form id="tabella1" name="tabella1">
    <input name="numelencotrasm" type="hidden" value=""/>
    <input name="dtelencotrasm" type="hidden" value=""/>
    <table width="275px" cellspacing="0" cellpadding="1" border="1">
        <tr>
            <td class="TabellaTitolo" width="50%">
                Numero Distinta
            </td>
            <td class="TabellaTitolo" width="50%">
                Data Distinta
            </td>
            <td class="TabellaTitolo" width="50%">
                #
            </td>
        </tr>
        <%
        try{
            while(rs.next()){
        %>
        <tr>
            <td>
                <input type="text" value="<% out.print(rs.getInt(1)); %>"/>
            </td>
            <td>
                <input type="text" value="<% out.print(rs.getDate(2)); %>"/>
            </td>
            <td>
                <a href="#" onclick="javascript:setValue('<% out.print(rs.getInt(1)); %>','<% out.print(rs.getDate(2));%>');">
                    Click-me
                </a>
            </td>
        </tr>
        <%
            }
        }catch(Exception e){
            response.sendRedirect("../index.jsp");
        }
        %>
    </table>
</form>
<script language="Javascript">


    function setValue(num, dt){
        document.tabella1.numelencotrasm.value=num;
        document.tabella1.dtelencotrasm.value=dt;
        alert(document.tabella1.numelencotrasm.value); //test
        alert(document.tabella1.dtelencotrasm.value);//test
    }
</script>

Well .. I now want to create a new html-table click on the line “#” reads data from the database passing the values ​​of the selected row.

I apologize for the basic English! :/

  • 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-04T14:52:33+00:00Added an answer on June 4, 2026 at 2:52 pm

    You require following changes in the above jsp code:

    1. Add action URL to your form.
    2. Make a call to submit form, after call to setValue().

    In the action jsp:

    1. Capture the parameters submitted by the above page,
    2. Process on them further for detailed data from your database,
    3. Construct an html table, and fill it to display.

    This is a simple solution given, thinking you just started learning.

    Update 1:

    I want to display an iframe that contains the date table2 on click of the table1.

    For this you need following changes in your current JSP.

    1. Define action URL as another JSP. It shall be something like action="targetPage.jsp".
    2. Define target attribute value for the form as your iframe. It
      shall be like target="nameOfTheIframe".
    3. Define and place an iframe in the page as appropriately. It shall be similar to <iframe name="targetIframe" src="about:blank"></iframe>.
    4. In the JavaScript setValue function write instructions to submit the form.
    5. In your other JSP, receive parameters submitted by this form,
      process them and display result.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My problem is I have one html table in jsp page .And i applied
Here is a problem I have encountered. I have jsp page which has a
I have a problem in my Java webapp. Here is the code in index.jsp:
I have a jsp page and problem is that when I click the logout
I have read this jsp page encoding problem and this Save Chinese characters with
I have a problem and can't find information. I run my web-app from jsp-page
I have a problem with forwarding to a .jsp page. Let me describe my
i am new in JSP,i have some problem with the following code : <%@
I have this jsp client that consumes a webservice. The problem with the client
I have problem with fancybox. I want to write a function that will run

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.