我正在servlet的Webcontent文件夹中发送对html资源的请求。但它没有派遣它。即使它没有给出任何例外。 AboutUs是一个放置在项目的 WebContent 文件夹中的html页面。我正在使用的IDE是eclipse。我对Web开发很新。任何帮助将不胜感激。
提前致谢。
Servlet代码:
@WebServlet("/Login")
public class Login extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public Login() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String name="";
String pass="";
name=request.getParameter("param1");
pass=request.getParameter("param2");
System.out.println("Name :" +name+"PAss :"+pass);
if (name!=null && pass!=null){
List<User> please = DataAccessUtil.getByEmail(name, pass);
if (please!=null)
{
int count = please.size();
System.out.println("Record Found : " + count);
if(!(count==0))
{
Iterator<User> iterator = please.iterator();
while(iterator.hasNext())
{
User object = (User) iterator.next();
String email = object.getEmail();
HttpSession session = request.getSession();
session.setMaxInactiveInterval(60);
session.setAttribute("email", email);
}
RequestDispatcher r= request.getRequestDispatcher("/AboutUs.html");
r.forward(request, response);
log("please");
}
else{
RequestDispatcher rd= request.getRequestDispatcher("/DR.html");
rd.forward(request, response);
log("please2");
}
}
}
else{
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}