SCJP 1.5
Merrill
Consultant, Sima Solutions
SCJP 1.5
SCJP 1.5
Merrill
Consultant, Sima Solutions
SCJP 1.5
Merrill
Consultant, Sima Solutions
package actions;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.action.ActionMessage;
import beans.UserLoginForm;
import dao.DBHelper;
public class LoginUserAction extends org.apache.struts.action.Action
{
// Global Forwards
public static final String GLOBAL_FORWARD_getUser = "getUser";
// Local Forwards
public static final String FORWARD_success = "success";
public static final String FORWARD_failed = "failed";
public LoginUserAction()
{
}
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
UserLoginForm ulf = (UserLoginForm)form;
ActionErrors errors = new ActionErrors();
DBHelper dao = new DBHelper();
//HttpSession session = request.getSession();
System.out.println("Loggin in...");
System.out.println("Username: " + ulf.getUsername());
System.out.println("Password: " + ulf.getPassword());
if (dao.isExisting(ulf.getUsername(), ulf.getPassword()) == true)
{
return (mapping.findForward(FORWARD_success));
}
else
{
errors.add("usernamepassword", new ActionMessage("login.invalid"));
//super.saveErrors(request, errors);
super.saveMessages(request, errors);
return (mapping.findForward(FORWARD_failed));
}
//return (mapping.findForward(FORWARD_failed));
}
}
SCJP 1.5
Merrill
Consultant, Sima Solutions
SCJP 1.5
Merrill
Consultant, Sima Solutions
SCJP 1.5
Merrill
Consultant, Sima Solutions
That new kid is a freak. Show him this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|