我已经创建了一个注册表。我不知道为什么现在它不再工作了。现在我收到一个404错误:
类型状态报告
信息/酒店预订/注册
说明源服务器找不到目标资源的当前表示形式,或不愿意透露存在该表示形式。
这是我的
登记Java语言
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package hotel;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author OOPs
*/
public class Registration extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
String s1 = request.getParameter("ename");
String s2 = request.getParameter("nname");
String s3 = request.getParameter("pname");
String s4 = request.getParameter("usid");
String s5 = request.getParameter("gm");
PrintWriter out = response.getWriter();
try {
/* TODO output your page here. You may use following sample code.
out.println(s1);
out.println(s2);
out.println(s3);
out.println(s4);
out.println(s5);*/
// out.println(s1);
//concetivity...............
Class.forName("com.mysql.jdbc.Driver");
out.println("driver loaded");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/HotelReservation","root" ,"123456789");
out.println("Connect");
Statement st = con.createStatement();
out.println("conncetion successfull");
st.executeUpdate("insert into register (email,name,pass) values ('"+s1+"','"+s2+"','"+s3+"')");
out.println("<h1> Register sucsefulltttt </h1>");
response.sendRedirect("thankyou.jsp");
}catch(Exception e){
out.println("nahiiiiiiiiiiiii" +e);
}
finally {
out.close();
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
而这是我的
登记jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Registration</title>
<style>
@import url( css/default.css);
</style>
</head>
<body>
<div id="container">
<div id="nav">
<a href="home.html">Home</a>
<a href="prenotazione.jsp">Prenotazione</a>
<a href="Room.html">Camere</a>
<a href="login.jsp">Login</a>
<a href="registration.jsp">Registrazione</a>
</div>
<script>
function validate()
{
if(document.getElementById("ename").value=="")
{
alert("blank");
return false;
}
return true;
}
</script>
<h2>Registrazione</h2>
<form action="Registration" method="post" onsubmit="return validate();">
<div class="gender">
<label id="icon" for="name"><i class="icon-envelope "></i></label>
<input type="text" name="ename" id="ename" placeholder="Email" required/>
<br>
<br>
<label id="icon" for="name"><i class="icon-user"></i></label>
<input type="text" name="nname" id="nname" placeholder="Name" required/>
<br>
<br>
<label id="icon" for="name"><i class="icon-shield"></i></label>
<input type="password" name="pname" id="pname" placeholder="Password" required/>
<br>
<input class="button" type="submit" value="Sign UP" name="b1"> </input>
<input class="button" type=button onClick="location.href='login.jsp'" value="Login" name="b" > </input>
</form>
<div id="footer">
<h4>Hotel Reservation </h4>
Viale Marco Polo, 81 Roma
tel: +39 01 0000000 | info@hotelreservation.it
P.IVA 000000001
</div>
</div>
</body>
</html>
你认为我怎样才能解决这个问题?谢谢
编辑:这是我的:
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Hotelbooking</display-name>
<servlet>
<servlet-name>Hotelbooking</servlet-name>
<servlet-class>hotel.Hotelbooking</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Hotelbooking</servlet-name>
<url-pattern>/hotelbooking</url-pattern>
</servlet-mapping>
<display-name>Login</display-name>
<servlet>
<servlet-name>Login</servlet-name>
<servlet-class>hotel.Login</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
<display-name>Logout</display-name>
<servlet>
<servlet-name>Logout</servlet-name>
<servlet-class>hotel.Logout</servlet-class>
</servlet>
<display-name>Registration</display-name>
<servlet>
<servlet-name>Registration</servlet-name>
<servlet-class>hotel.Registration</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Registration</servlet-name>
<url-pattern>/registration</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>home.html</welcome-file>
</welcome-file-list>
</web-app>
HTTP状态404–未找到
类型状态报告
信息/酒店预订/注册
说明源服务器找不到目标资源的当前表示形式,或不愿意透露存在该表示形式。
我的项目
编写您的doGet
方法以在registration.jsp
转发,如下所示
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.getRequestDispatcher("/registration.jsp").forward(request, response);
}
错误消息图中的另一件事是显示酒店预订/注册,但在web中显示。xml文件servlet映射为注册。所以点击正确的url
我是Spring靴的初学者。 我刚刚写了一个控制器,代码在这里。 然后当我访问“localhost:8080”时,我得到了正确的页面。但是当我访问“localhost:8080/hello/someName”时,我得到了“白标签错误页面”。 我的代码怎么了?非常感谢。
win10下 phpstudy切换成PHP8就报404的错误,请教高手要如何修改?
我已经跟随杰弗里·韦的教程。 教程: https://laracasts.com/series/real-time-laravel-with-socket-io/episodes/1 null 我尝试使用
报名这一功能可将多科目多场考试集合在一场报名,便于考生自主选择科目进行报考,考试主办方方可自主选择报名考生。 创建报名 报名流程图 创建报名的步骤: 第一步:填写报名基本信息(不勾选开启报名审核的考试,默认所有报名考生通过审核) 第二步:勾选需要采集的考生信息 第三步:在报名详情页里的“科目管理”创建需要的科目 第四步:在报名详情页里的“考试管理”创建需要的考试 第五步:将已报名考生编排到考试中
我不知道发生了什么,但在浏览器控制台中,我可以看到3个与字体相关的错误 我知道这是荒谬的,我不能自己解决这个问题,但一切似乎都好,在我的index.html我有这样的东西 这就是我所有与字体相关的东西,我已经检查了路径,我没有错。 这是发生在你们中间的吗? 更新 这是NGINX部分,我在头部加载了一些内容