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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:35:04+00:00 2026-05-29T22:35:04+00:00

I created a web application that edit a database… I would like to know

  • 0

I created a web application that edit a database…

I would like to know how I add or redirect the page after clicking on submit.

Sorry i’m still learning…

Currently Im using “usebean” to insert the content of the form to the database. I would like to know if how to redirect the page after the enter all info in the fields then click submit..

Thanks

here’s the code:

<%@ page language="Java" import="java.sql.*" %>


<head>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<html>
    <head><title>CSN Survey</title></head>


<body bgcolor="#ffffff">

 <div>
    <img id="title" src="images/CSN.gif" width="243" height="27" alt="CSN"/>
    <img id="logo" src="images/tr_logo_40.gif" width="178" height="40" alt="tr_logo_40"/>
 </div>
    <hr>
     <h1> insert comment </h1>

<div id="container">

    <form action=""  name="form1" method="POST">
        <br>
        <br>
        <br>

        <td><br>Write your comment here:</td>

                 <div id="q1"

                 <td>id:<%=request.getParameter("id")%></td>
                 <td>First name:<textarea name="first_name" rows="1" cols="10"></textarea></td>
                 <td>Last name:<textarea name="last_name" rows="1" cols="10"></textarea></td>
                 <br>
         <br>
                 </div>

                 <td>


                 <input type = "submit" value="Submit">
                 </td>

    </form>
    </div>

                 <jsp:useBean id="survey" class="csnsurveysource.csnsurveyclass" scope="page">
            <jsp:setProperty name="survey" property="*"/>


        </jsp:useBean>

    <% survey.insert();%> 

</body>
</html>

csnsurveyclass.java:

package csnsurveysource;
import java.io.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;


public class csnsurveyclass
{

    private int id;
    private String first_name;
    private String last_name;

    private Connection connection=null;
    private ResultSet rs = null;
    private Statement st = null;
    String connectionURL = "jdbc:postgresql://localhost:5432/test";


    public csnsurveyclass()
    {
         try {
             // Load the database driver
            Class.forName("org.postgresql.Driver");
            // Get a Connection to the database
            connection = DriverManager.getConnection(connectionURL, "postgres", "qqQQ11!!");
            }catch(Exception e){
            System.out.println("Exception is ;"+e);
            }

        }

        public void setid(int id)
    {
        this.id = id;
    }

    public int getid()
    {
        return (this.id);
    }

    public void setfirst_name(String first_name)
    {
        this.first_name = first_name;
    }

    public String getfirst_name()
    {
        return (this.first_name);
    }
        public void setlast_name(String last_name)
    {
        this.last_name = last_name;
    }

    public String getlast_name()
    {
        return (this.last_name);
    }


    public void insert()
    {

       try
       {
            String sql = "update testing set fname = '"+first_name+"',lname = '"+last_name+"' where id = "+id+"";
            Statement s = connection.createStatement();
            s.executeUpdate (sql);
            s.close ();

        }
       catch(Exception e){
            System.out.println("Exception is ;"+e);
                    }
    }
    }
  • 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-29T22:35:05+00:00Added an answer on May 29, 2026 at 10:35 pm

    It will be good to use MVC pattern, you can move business logic

     survey.insert();
    

    into controller and then send redirect

    response.sendRedirect("...");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that when a war file is created of my web application, i
I created an MVC web application that was using a MSSQL database store for
I've created a web application that I've hosted with IIS 7 on a Windows
I am working on an ASP.Net web application that must print dynamically created labels
We have created a web application, using ASP.NET, that allows users to upload documents
I've created a web.py application, and now that it is ready to be deployed,
I have created a timeclock application in C# that connects to a web service
I have a web application that uses a relational database (MySQL). We're adding a
I'm working on a world clock web application, and I'd like to add a
We have a web application that is built on top of a SQL database.

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.