Все !!!NetBeans - HTTP Status 404 - Не найдено - описание Запрошенного ресурса не доступно
У меня проблема .... У меня есть приложение JEE, и когда я нажимаю кнопку OK, покажите это сообщение: HTTP Status 404 - Not Found - description Запрошенный ресурс недоступен.
JSP:
<%@include file="_header.jsp" %>
<img src="include/sections/projetos.jpg" align="bottom" /><h1 id="title">ProfessorInserir</h1>
<p id="text">
Inserção de Professores
</p>
<form action="professor">
Matrícula: <input type="text" name="mat"/>
<br/>Nome: <input type="text" name="nome"/>
<br/>Disciplina: <input type="text" name="disc"/>
<input type="hidden" name="acao" value="inserir"/>
<br/> <input type="submit" value="ok"/>
</form>
<%@include file="_footer.jsp" %>
Java Класс:
package modelo;
public class Professor {
private String mat;
private String nome;
private String disc;
public String getMat() {
return mat;
}
public void setMat(String mat) {
this.mat = mat;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getDisc() {
return disc;
}
public void setDisc(String disc) {
this.disc = disc;
}
}
Servlet:
package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import modelo.Professor;
public class ServletProfessor extends HttpServlet {
private ArrayList professores = new ArrayList();
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String comando = request.getParameter("acao");
if (comando.equals("inserir")){
String mat = request.getParameter("mat");
String nome = request.getParameter("nome");
String disc = request.getParameter("disc");
Professor p = new Professor();
p.setMat(mat);
p.setNome(nome);
p.setDisc(disc);
professores.add(p);
response.sendRedirect("professorInserir.jsp");
}
}
@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);
}
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="WebApp_ID" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>academicnet</display-name>
<servlet>
<description />
<display-name>ServletLogin</display-name>
<servlet-name>ServletLogin</servlet-name>
<servlet-class>servlets.ServletLogin</servlet-class>
</servlet>
<servlet>
<description />
<display-name>ServletLogout</display-name>
<servlet-name>ServletLogout</servlet-name>
<servlet-class>servlets.ServletLogout</servlet-class>
</servlet>
<servlet>
<servlet-name>ServletAluno</servlet-name>
<servlet-class>servlets.ServletAluno</servlet-class>
</servlet>
<servlet>
<servlet-name>ServletProfessor</servlet-name>
<servlet-class>servlets.ServletProfessor</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletLogin</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ServletLogout</servlet-name>
<url-pattern>/logout</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ServletAluno</servlet-name>
<url-pattern>/aluno</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ServletProfessor</servlet-name>
<url-pattern>/ServletProfessor</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
Pls Помогите мне !!!
Можете ли вы разместить свой 'web.xml'? –
Вставьте свой контент 'web.xml'. –
Опубликовано! Благодаря! –