Monday, July 23, 2012

1.2 Basic Struts Example


RegisterAction1.java

package coreservlets;
import javax.servlet.http.*;


import org.apache.struts.action.*;


public class RegisterAction1 extends Action {
  public ActionForward execute(ActionMapping mapping,
                               ActionForm form,
                               HttpServletRequest request,
                               HttpServletResponse response)
      throws Exception {
UserFormBean userBean = (UserFormBean)form;
    String email = userBean.getEmail();
    String password = userBean.getPassword();
if(email.equals("om@gmail.com"))
{
if(password.equals("om"))
return(mapping.findForward("success"));
else
return(mapping.findForward("bad-password"));
}
 else
     return(mapping.findForward("bad-address"));
  }
}

No comments:

Post a Comment