www.pudn.com > JSP2Struts.rar > RegistAction.java


package com; 
 
import java.io.IOException; 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpSession; 
import javax.servlet.http.HttpServletResponse; 
import org.apache.struts.action.Action; 
import org.apache.struts.action.ActionForm; 
import org.apache.struts.action.ActionForward; 
import org.apache.struts.action.ActionMapping; 
 
import com.UserForm; 
 
public final class RegistAction extends Action 
{ 
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException 
    {  
        UserForm userForm = (UserForm) form; 
 
	String username = userForm.getName(); 
 
	String password = userForm.getPs(); 
 
        String target = new String("success"); 
 
        if(username.equals("mcg") && password.equals("mcg")) 
        { 
            target = new String("success"); 
        } 
        else 
            target = new String("failure"); 
 
        return(mapping.findForward(target));  
    } 
}