** My Problem is when i run my index.jsp every time i got this error in my showAlien.jsp file and how to solve this **
CODE
index/jsp
<html>
<body>
<h2>Hello World!</h2>
<form action="getAlien">
<input type="text" name="aid">
<input type="submit">
</form>
</body>
</html>
GetAlienController
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;
@WebServlet("/getAlien")
public class GetAlienController extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int aid = Integer.parseInt(request.getParameter("aid"));
AlienDao dao = new AlienDao();
Alien a1 = dao.getAlien(aid);
request.setAttribute("alien", a1);
RequestDispatcher rd = request.getRequestDispatcher("showAlien.jsp");
rd.forward(request, response);
}
}
Alien.java
public class Alien {
private int aid;
private String aname;
private String tech;
public int getAid() {
return aid;
}
public void setAid(int aid) {
this.aid = aid;
}
public String getAname() {
return aname;
}
public void setAname(String aname) {
this.aname = aname;
}
public String getTech() {
return tech;
}
public void setTech(String tech) {
this.tech = tech;
}
@Override
public String toString() {
return "Alien [aid=" + aid + ", aname=" + aname + ", tech=" + tech + "]";
}
}
AlienDao.java
public class AlienDao {
public Alien getAlien(int aid) {
Alien a = new Alien();
a.setAid(101);
a.setAname("ss");
a.setTech("java");
return a;
}
}
showAlien
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>ShowAliens....</title>
</head>
<body bgcolor="cyan">
<%
Alien a1 = (Alien)request.getAttribute("alien");
out.println("Hello");
%>
</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_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>M</display-name>
<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>
Is something wrong with my web.xml file Sorry for posting the whole code but i am unable to tell my whole problem.