Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Im working on small web and when the user click bank it has bank list and when the user click one of the bank from

Im working on small web and when the user click bank it has bank list and when the user click one of the bank from the list I want to redirect to webservlet java class. However, when the user clicked one of bank from the list it didnt redirect to webservlet java class.

this is my HTML

HomePage.html

Demonstrating the Box Model

  • Demonstrating the Box Model
  • Bank
    • Bank1
    • Bank2
    • Bank3
  • Hotel
    • Hotel1
    • Hotel2
    • Hotel3
    • Options
  • About Us

web.xml

Bank-Stock HomePage.html CustomerInfo com.javaguides.registration.controller.Customers CustomerInfo /registerET

java class

package com.javaguides.registration.controller;

import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.getInfo.CustomerPOJO; import com.registration.CustomerInfo;

public class Customers extends HttpServlet{ private static final long serialVersionUID = 1L; CustomerInfo customerInfo; public void init() { customerInfo = new CustomerInfo(); } public Customers() { super(); } //get info from the user protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter().append("Served at: ") .append(request.getContextPath()); RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/views/employeeregister.jsp"); dispatcher.forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String firstName = request.getParameter("firstName"); String lastName = request.getParameter("lastName"); String phoneNumber = request.getParameter("phoneNumber");

CustomerPOJO customerPOJO = new CustomerPOJO(); customerPOJO.setFirstName(firstName); customerPOJO.setLastName(lastName); customerPOJO.setPhoneNumber(phoneNumber); try { customerInfo.registerEmployee(customerPOJO); } catch (Exception e) { e.printStackTrace(); } RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/views/employeedetails.jsp"); dispatcher.forward(request, response); }

}

Web Homepage

image text in transcribed

my project structure

image text in transcribed

The error when I redirect

image text in transcribed

Home Bank Hotel About Us > > > > src > > com.getInfo >>com.javaguides.registration.controller > > com.registration Y logback.xml JRE System Library [JavaSE-1.8] Maven Dependencies build target test-classes Co> WebContent > > META-INF > WEB-INF lib > > views web.xml HomePage.html pom.xml Your file couldn't be accessed It may have been moved, edited, or deleted. ERR_FILE_NOT_FOUND Home Bank Hotel About Us > > > > src > > com.getInfo >>com.javaguides.registration.controller > > com.registration Y logback.xml JRE System Library [JavaSE-1.8] Maven Dependencies build target test-classes Co> WebContent > > META-INF > WEB-INF lib > > views web.xml HomePage.html pom.xml Your file couldn't be accessed It may have been moved, edited, or deleted. ERR_FILE_NOT_FOUND

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_2

Step: 3

blur-text-image_3

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

Oracle Databases On The Web Learn To Create Web Pages That Interface With Database Engines

Authors: Robert Papaj, Donald Burleson

11th Edition

1576100995, 978-1576100998

More Books

Students also viewed these Databases questions