WEB开发网
开发学院软件开发Java JAVA AJAX教程第一章—初识AJAX 阅读

JAVA AJAX教程第一章—初识AJAX

 2009-10-27 00:00:00 来源:WEB开发网   
核心提示: LoginAction.java代码如下: packageclassmate;importjava.io.IOException;importjavax.servlet.ServletException;importjavax.servlet.http.HttpServlet;importjav

LoginAction.java代码如下:

package classmate; 
import java.io.IOException; 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
import javax.servlet.http.HttpSession; 
public class LoginAction_refersh extends HttpServlet { 
       @Override 
       protected void service(HttpServletRequest req, HttpServletResponse resp) 
                     throws ServletException, IOException { 
              // TODO Auto-generated method stub 
              String uname = req.getParameter("uname"); 
              String pwd = req.getParameter("pwd"); 
              String target = ""; 
              HttpSession session = req.getSession(); 
              if(uname.equals("yhw")&&pwd.equals("admin")){ 
                     session.setAttribute("result", "ok"); 
                     target = "/ajaxtest/login.jsp"; 
              }else{ 
                     session.setAttribute("result", "wrong"); 
                     target = "/ajaxtest/login.jsp"; 
              } 
              resp.sendRedirect(target); 
       } 
} 

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:JAVA AJAX 教程

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接