Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am trying to create a registration page using the code below however, it doesn't work. It doesn't store the data into the registration table

I am trying to create a registration page using the code below however, it doesn't work. It doesn't store the data into the registration table that i created. i need help fixing it. The program uses intellij IDEA html and java.

Registrationservlet.java

package com.example.demo; import java.io.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.http.*; import javax.servlet.annotation.*; @WebServlet(name = "registrationServlet", value = "/registration-servlet") public class RegistrationServlet extends HttpServlet { private String message; public void init() { message = "Welcome!"; } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String username = request.getParameter("uname"); String password = request.getParameter("pword"); String email = request.getParameter("email"); String repass = request.getParameter("repass"); try{ Class.forName("oracle.jdbc.driver.OracleDrive"); Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); PreparedStatement ps=conn.prepareStatement( "insert into registeruser values(?,?,?,?)"); ps.setString(1,"name"); ps.setString(2,"pword"); ps.setString(3,"email"); ps.setString(4,"repass"); } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); } if(username.equals("Amali")) { // Hello out.println("

" + username + "

"); } else { // Hello out.println("

Not Valid

"); } out.println(""); } public void destroy() { } }

Registration.jsp

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> 

JSP - Welcome to Name of school

<%= "Name of school "%>

<%= "User Registration"%>

Username: Email Address: Password Re-Enter Password

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions

Question

What is Cost of Goods Sold (COGS) and where is it reported?

Answered: 1 week ago

Question

Find each integral in Problems 3848. [s 5e dt

Answered: 1 week ago

Question

Training of supervisors in conducting appraisals

Answered: 1 week ago