Question
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
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
my project structure
The error when I redirect
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started