----------------------
Action Class Example Which uses DynaActionForm
-----------------------------------------------------
package action;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class Login extends Action {
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
DynaActionForm loginForm = (DynaActionForm)form;
String username = (String)loginForm.get("userName");
String password = (String)loginForm.get("password");
System.out.println("user : "+username);
if(username == null || !username.equals("hari"))
return mapping.findForward("badusername");
else if(password==null || !password.equals("hari"))
return(mapping.findForward("badpassword"));
else
return(mapping.findForward("success"));
}
}
1 comment:
This is great info to know.
Post a Comment